diff options
author | kib <kib@FreeBSD.org> | 2015-12-20 11:55:39 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-12-20 11:55:39 +0000 |
commit | baa84555c9cbf07b84a84f908ceb545581fbc05a (patch) | |
tree | 6c15b332feb47d4da4ffbd4fa70edfb003d55c4a /lib/libc | |
parent | afbff2aff4535423469503c64c6a5334171fbc12 (diff) | |
download | FreeBSD-src-baa84555c9cbf07b84a84f908ceb545581fbc05a.zip FreeBSD-src-baa84555c9cbf07b84a84f908ceb545581fbc05a.tar.gz |
Fix lockf(3) cancellation behaviour.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/lockf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libc/gen/lockf.c b/lib/libc/gen/lockf.c index 2c567ba..c64a347 100644 --- a/lib/libc/gen/lockf.c +++ b/lib/libc/gen/lockf.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <fcntl.h> #include <unistd.h> #include "un-namespace.h" +#include "libc_private.h" int lockf(int filedes, int function, off_t size) @@ -62,9 +63,12 @@ lockf(int filedes, int function, off_t size) break; case F_TEST: fl.l_type = F_WRLCK; - if (_fcntl(filedes, F_GETLK, &fl) == -1) + if (((int (*)(int, int, ...)) + __libc_interposing[INTERPOS_fcntl])(filedes, F_GETLK, &fl) + == -1) return (-1); - if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && fl.l_pid == getpid())) + if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && + fl.l_pid == getpid())) return (0); errno = EAGAIN; return (-1); @@ -75,5 +79,6 @@ lockf(int filedes, int function, off_t size) /* NOTREACHED */ } - return (_fcntl(filedes, cmd, &fl)); + return (((int (*)(int, int, ...)) + __libc_interposing[INTERPOS_fcntl])(filedes, cmd, &fl)); } |