Commit cdadd32e authored by Samuel Thibault's avatar Samuel Thibault

hurd: Support lockf at offset 0 with size 0 or 1

patches/hurd-i386/git-lockf-0.diff
parent 8bb12033
......@@ -152,6 +152,8 @@ glibc (2.27-9) UNRELEASED; urgency=medium
* libc0.3.symbols.hurd-i386: Update symbols accordingly.
* patches/hurd-i386/git-spawn-open.diff: Fix crash on spawn with open
operation.
* patches/hurd-i386/git-lockf-0.diff: Support lockf at offset 0 with size 0 or
1.
-- Samuel Thibault <sthibault@debian.org> Sat, 03 Nov 2018 22:50:40 +0100
......
commit b15b1a959040fe8cdfbc51092a7b72032f6c9b86
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
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 <unistd.h>.
(__f_setlk): When whence is SEEK_CUR, use __lseek64 to convert it to
SEEK_SET.
diff --git a/sysdeps/mach/hurd/f_setlk.c b/sysdeps/mach/hurd/f_setlk.c
index 718af67e32..edfb292dbf 100644
--- a/sysdeps/mach/hurd/f_setlk.c
+++ b/sysdeps/mach/hurd/f_setlk.c
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <sys/file.h>
#include <fcntl.h>
+#include <unistd.h>
#include <errno.h>
/* 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:
......@@ -89,6 +89,7 @@ hurd-i386/git-msync.diff
hurd-i386/git-spawn-open.diff
hurd-i386/git-tst-preadvwritev2-common.c.diff
hurd-i386/git-fcntl64.diff
hurd-i386/git-lockf-0.diff
hurd-i386/tg-WRLCK-upgrade.diff
i386/local-biarch.diff
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment