From: GNU Libc Maintainers Date: Wed, 5 Dec 2018 18:50:21 +0000 (+0000) Subject: git-lockf-0 X-Git-Tag: archive/raspbian/2.28-2+rpi1^2~55 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2f0e76cc68779cd5305991fbd9d1c37e1756c219;p=glibc.git git-lockf-0 commit b15b1a959040fe8cdfbc51092a7b72032f6c9b86 Author: Samuel Thibault Date: Mon Nov 19 20:22:30 2018 +0100 hurd: Support lockf at offset 0 with size 0 or 1. * sysdeps/mach/hurd/f_setlk.c: Include . (__f_setlk): When whence is SEEK_CUR, use __lseek64 to convert it to SEEK_SET. Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name git-lockf-0.diff --- diff --git a/sysdeps/mach/hurd/f_setlk.c b/sysdeps/mach/hurd/f_setlk.c index 718af67e3..edfb292db 100644 --- a/sysdeps/mach/hurd/f_setlk.c +++ b/sysdeps/mach/hurd/f_setlk.c @@ -19,6 +19,7 @@ #include #include #include +#include #include /* XXX @@ -45,6 +46,18 @@ __f_setlk (int fd, int type, int whence, __off64_t start, __off64_t len, int wai if (cmd != LOCK_UN && wait == 0) cmd |= LOCK_NB; + if (whence == SEEK_CUR) + { + /* In case the target position is 0, we can support it below. */ + __off64_t cur = __lseek64 (fd, 0, SEEK_CUR); + + if (cur >= 0) + { + start = cur + start; + whence = SEEK_SET; + } + } + switch (whence) { case SEEK_SET: