Module Name: src
Committed By: manu
Date: Mon Oct 11 01:52:05 UTC 2010
Modified Files:
src/lib/libperfuse: ops.c
Log Message:
FUSE filesystems' readlink returns a resolved link with a NUL trailing
character, and PUFFS do not want it. This fixes this bug, that returned
stat the informations for x instead of reporting ENOENT:
mkdir x && ln x z && stat -x z/whatever/you/want
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libperfuse/ops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.21 src/lib/libperfuse/ops.c:1.22
--- src/lib/libperfuse/ops.c:1.21 Mon Oct 11 01:08:26 2010
+++ src/lib/libperfuse/ops.c Mon Oct 11 01:52:05 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.21 2010/10/11 01:08:26 manu Exp $ */
+/* $NetBSD: ops.c,v 1.22 2010/10/11 01:52:05 manu Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -2410,12 +2410,18 @@
goto out;
foh = GET_OUTHDR(ps, pm);
- len = foh->len - sizeof(*foh) + 1;
+ len = foh->len - sizeof(*foh);
if (len > *linklen)
DERRX(EX_PROTOCOL, "path len = %zd too long", len);
+ if (len == 0)
+ DERRX(EX_PROTOCOL, "path len = %zd too short", len);
- *linklen = len;
- (void)strlcpy(linkname, _GET_OUTPAYLOAD(ps, pm, char *), len);
+ /*
+ * FUSE filesystems return a NUL terminated string, we
+ * do not want to trailing \0
+ */
+ *linklen = len - 1;
+ (void)memcpy(linkname, _GET_OUTPAYLOAD(ps, pm, char *), len);
out:
ps->ps_destroy_msg(pm);