diff options
author | Andreas Jaeger <aj@suse.de> | 2000-10-30 06:47:34 +0000 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2000-10-30 06:47:34 +0000 |
commit | 35b99c57f4d50bcfb91126ab2e7520ea29aae6f0 (patch) | |
tree | d688bb311d7efb7bfafc8d20e378a536a4fca0b8 /sysdeps | |
parent | c6042c732e6d20fbecd227c03ef1efde17dc7d2c (diff) | |
download | glibc-35b99c57f4d50bcfb91126ab2e7520ea29aae6f0.tar glibc-35b99c57f4d50bcfb91126ab2e7520ea29aae6f0.tar.gz glibc-35b99c57f4d50bcfb91126ab2e7520ea29aae6f0.tar.bz2 glibc-35b99c57f4d50bcfb91126ab2e7520ea29aae6f0.zip |
In the case of F_TEST, set l_type to F_RDLCK explicitly.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/lockf64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/lockf64.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/sysdeps/generic/lockf64.c b/sysdeps/generic/lockf64.c index 3d27964879..0caae6ae44 100644 --- a/sysdeps/generic/lockf64.c +++ b/sysdeps/generic/lockf64.c @@ -49,6 +49,7 @@ lockf64 (int fd, int cmd, off64_t len64) case F_TEST: /* Test the lock: return 0 if FD is unlocked or locked by this process; return -1, set errno to EACCES, if another process holds the lock. */ + fl.l_type = F_RDLCK; if (__fcntl (fd, F_GETLK, &fl) < 0) return -1; if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) diff --git a/sysdeps/unix/sysv/linux/i386/lockf64.c b/sysdeps/unix/sysv/linux/i386/lockf64.c index f4603cfee2..774cca2ca5 100644 --- a/sysdeps/unix/sysv/linux/i386/lockf64.c +++ b/sysdeps/unix/sysv/linux/i386/lockf64.c @@ -85,6 +85,7 @@ lockf64 (int fd, int cmd, off64_t len64) /* Test the lock: return 0 if FD is unlocked or locked by this process; return -1, set errno to EACCES, if another process holds the lock. */ #if __ASSUME_FCNTL64 > 0 + fl64.l_type = F_RDLCK; if (INLINE_SYSCALL (fcntl64, 3, fd, F_GETLK64, &fl64) < 0) return -1; if (fl64.l_type == F_UNLCK || fl64.l_pid == __getpid ()) @@ -95,8 +96,10 @@ lockf64 (int fd, int cmd, off64_t len64) # ifdef __NR_fcntl64 if (!__have_no_fcntl64) { - int res = INLINE_SYSCALL (fcntl64, 3, fd, F_GETLK64, &fl64); + int res; + fl64.l_type = F_RDLCK; + res = INLINE_SYSCALL (fcntl64, 3, fd, F_GETLK64, &fl64); /* If errno == ENOSYS try the 32bit interface if len64 can be represented with 32 bits. */ @@ -120,6 +123,7 @@ lockf64 (int fd, int cmd, off64_t len64) } } # endif + fl.l_type = F_RDLCK; if (__fcntl (fd, F_GETLK, &fl) < 0) return -1; if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) |