Module Name: src Committed By: msaitoh Date: Mon Nov 3 19:31:39 UTC 2014
Modified Files: src/lib/libperfuse [netbsd-6]: ops.c Log Message: Pull up following revision(s) (requested by manu in ticket #1144): lib/libperfuse/ops.c: revision 1.70 We used to remove the trailing zeros in FUSE readlink replies, but it seems it does not always happen. Just remove them if present. To generate a diff of this commit: cvs rdiff -u -r1.50.2.8 -r1.50.2.9 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.50.2.8 src/lib/libperfuse/ops.c:1.50.2.9 --- src/lib/libperfuse/ops.c:1.50.2.8 Mon Nov 3 19:18:09 2014 +++ src/lib/libperfuse/ops.c Mon Nov 3 19:31:39 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ops.c,v 1.50.2.8 2014/11/03 19:18:09 msaitoh Exp $ */ +/* $NetBSD: ops.c,v 1.50.2.9 2014/11/03 19:31:39 msaitoh Exp $ */ /*- * Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved. @@ -2623,12 +2623,16 @@ perfuse_node_readlink(struct puffs_userm if (len == 0) DERRX(EX_PROTOCOL, "path len = %zd too short", len); + (void)memcpy(linkname, _GET_OUTPAYLOAD(ps, pm, char *), len); + /* * FUSE filesystems return a NUL terminated string, we - * do not want to trailing \0 + * do not want the trailing \0 */ - *linklen = len - 1; - (void)memcpy(linkname, _GET_OUTPAYLOAD(ps, pm, char *), len); + while (len > 0 && linkname[len - 1] == '\0') + len--; + + *linklen = len; ps->ps_destroy_msg(pm); error = 0;