*/
#include "h/mh.h"
+#include "context_find.h"
#include "error.h"
#include "h/signals.h"
#include "h/utils.h"
int fd;
if (oflags == -1) {
- errno = EINVAL;
+ errno = EINVAL;
return NULL;
}
int fd;
if (oflags == -1) {
- errno = EINVAL;
+ errno = EINVAL;
return NULL;
}
int rc = close(fd);
if (datalocktype == DOT_LOCKING)
- lkclose_dot(fd, name);
+ lkclose_dot(fd, name);
return rc;
}
int fd, rc;
if (f == NULL)
- return 0;
+ return 0;
fd = fileno(f);
rc = fclose(f);
if (datalocktype == DOT_LOCKING)
- lkclose_dot(fd, name);
+ lkclose_dot(fd, name);
return rc;
}
int rc = close(fd);
if (spoollocktype == DOT_LOCKING)
- lkclose_dot(fd, name);
+ lkclose_dot(fd, name);
return rc;
}
int fd, rc;
if (f == NULL)
- return 0;
+ return 0;
fd = fileno(f);
rc = fclose(f);
if (spoollocktype == DOT_LOCKING)
- lkclose_dot(fd, name);
+ lkclose_dot(fd, name);
return rc;
}
switch (ltype) {
case FCNTL_LOCKING:
- return lkopen_fcntl(file, access, mode, failed_to_lock);
+ return lkopen_fcntl(file, access, mode, failed_to_lock);
case DOT_LOCKING:
- return lkopen_dot(file, access, mode, failed_to_lock);
+ return lkopen_dot(file, access, mode, failed_to_lock);
#ifdef HAVE_FLOCK
case FLOCK_LOCKING:
- return lkopen_flock(file, access, mode, failed_to_lock);
+ return lkopen_flock(file, access, mode, failed_to_lock);
#endif /* HAVE_FLOCK */
#ifdef HAVE_LOCKF
case LOCKF_LOCKING:
- return lkopen_lockf(file, access, mode, failed_to_lock);
+ return lkopen_lockf(file, access, mode, failed_to_lock);
#endif /* HAVE_FLOCK */
default:
- die("Internal locking error: unsupported lock type used!");
+ die("Internal locking error: unsupported lock type used!");
}
return -1;
*/
for (i = 0; i < LOCK_RETRIES; i++) {
- if ((fd = open(file, access, mode)) == -1)
+ if ((fd = open(file, access, mode)) == -1)
return -1;
flk.l_start = 0;
*/
locktype = (((access & O_ACCMODE) == O_RDONLY) ? LOCK_SH : LOCK_EX) |
- LOCK_NB;
+ LOCK_NB;
for (i = 0; i < LOCK_RETRIES; i++) {
- if ((fd = open(file, access, mode)) == -1)
+ if ((fd = open(file, access, mode)) == -1)
return -1;
if (flock(fd, locktype) != -1)
access &= ~O_APPEND;
if ((access & O_ACCMODE) == O_RDONLY) {
- access &= ~O_RDONLY;
+ access &= ~O_RDONLY;
access |= O_RDWR;
}
for (i = 0; i < LOCK_RETRIES; i++) {
- if ((fd = open(file, access, mode)) == -1)
+ if ((fd = open(file, access, mode)) == -1)
return -1;
if (lockf(fd, F_TLOCK, 0) != -1) {
* Seek to end if requested
*/
if (saved_access & O_APPEND) {
- lseek(fd, 0, SEEK_END);
+ lseek(fd, 0, SEEK_END);
}
return fd;
}
init_locktype(const char *lockname)
{
if (strcasecmp(lockname, "fcntl") == 0) {
- return FCNTL_LOCKING;
+ return FCNTL_LOCKING;
}
if (strcasecmp(lockname, "lockf") == 0) {
#ifdef HAVE_LOCKF
#endif /* HAVE_FLOCK */
}
if (strcasecmp(lockname, "dot") == 0) {
- return DOT_LOCKING;
+ return DOT_LOCKING;
}
die("Unknown lock type: \"%s\"", lockname);
/* NOTREACHED */