aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.txt3
-rw-r--r--pseudo.c17
2 files changed, 13 insertions, 7 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 08dbd4d..3eef742 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,6 @@
+2015-07-16:
+ * (seebs) don't truncate xattr attributes that end with a slash.
+
2015-05-04:
* (seebs) don't give spurious trailing slash diagnostics
* 1.6.5
diff --git a/pseudo.c b/pseudo.c
index c089869..a524676 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -542,10 +542,20 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
oldpathlen = msg->pathlen - (oldpath - msg->path) - 1;
pseudo_debug(PDBGF_OP | PDBGF_FILE | PDBGF_XATTR, "%s: path '%s', oldpath '%s' [%d/%d]\n",
pseudo_op_name(msg->op), msg->path, oldpath, (int) oldpathlen, (int) msg->pathlen);
+ /* 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] == '/') {
+ oldpath[--oldpathlen] = '\0';
+ old_trailing_slash = 1;
+ }
+ }
/* if we got an oldpath, but a 0-length initial
* path, we don't want to act as though we had
* a non-empty initial path.
*/
+
msg->pathlen = initial_len;
break;
default:
@@ -571,13 +581,6 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
}
}
- if (oldpathlen > 0) {
- if (oldpath[oldpathlen - 1] == '/') {
- oldpath[--oldpathlen] = '\0';
- old_trailing_slash = 1;
- }
- }
-
/* There should usually be a path. Even for f* ops, the client
* tries to provide a path from its table of known fd paths.
*/