aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeebs <seebs@seebs.net>2016-10-31 13:09:54 -0500
committerSeebs <seebs@seebs.net>2016-10-31 13:09:54 -0500
commitd5a6b5e2d23288452b374a1ffe32b6b3e52c13fc (patch)
tree0588bb2d0541899d2bc02966d70d8ff8456ca923
parent6a72669c63b598f383b56becc04863db439ec6ae (diff)
downloadpseudo-d5a6b5e2d23288452b374a1ffe32b6b3e52c13fc.tar.gz
pseudo-d5a6b5e2d23288452b374a1ffe32b6b3e52c13fc.tar.bz2
pseudo-d5a6b5e2d23288452b374a1ffe32b6b3e52c13fc.zip
Fix extra data on xattrs
For some reason, extended attributes were getting garbage appended in some cases. Attempt to fix this. Signed-off-by: Seebs <seebs@seebs.net>
-rw-r--r--ChangeLog.txt4
-rw-r--r--pseudo.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 6466806..d2e8618 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,4 +1,8 @@
2016-10-31:
+ * (seebs) match comments by ACTUALLY trimming the null byte
+ on xattrs on write.
+
+2016-10-31:
* (seebs) drop silly if
2016-10-29:
diff --git a/pseudo.c b/pseudo.c
index db1c400..df2a419 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -496,10 +496,13 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
/* For a rename op, we want to strip any trailing
* slashes. For xattr, "oldpath" is the raw data
* to be stored. */
- if (oldpathlen > 0 && msg->op == OP_RENAME) {
- if (oldpath[oldpathlen - 1] == '/') {
+ if (msg->op == OP_RENAME) {
+ if (oldpathlen > 0 && oldpath[oldpathlen - 1] == '/') {
oldpath[--oldpathlen] = '\0';
}
+ } else {
+ /* disregard the trailing null */
+ --oldpathlen;
}
/* if we got an oldpath, but a 0-length initial
* path, we don't want to act as though we had