Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libperfuse We used to remove the trailing zeros in FUSE ...
details: https://anonhg.NetBSD.org/src/rev/3f7b4560f0d8
branches: trunk
changeset: 331887:3f7b4560f0d8
user: manu <manu%NetBSD.org@localhost>
date: Fri Aug 29 04:58:40 2014 +0000
description:
We used to remove the trailing zeros in FUSE readlink replies, but
it seems it does not always happen. Just remove them if present.
diffstat:
lib/libperfuse/ops.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (29 lines):
diff -r 4b6d4bc4ba79 -r 3f7b4560f0d8 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Thu Aug 28 20:40:57 2014 +0000
+++ b/lib/libperfuse/ops.c Fri Aug 29 04:58:40 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.69 2014/08/19 15:29:14 manu Exp $ */
+/* $NetBSD: ops.c,v 1.70 2014/08/29 04:58:40 manu Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -2633,12 +2633,16 @@
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;
Home |
Main Index |
Thread Index |
Old Index