aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2015-07-16 13:37:54 -0500
committerPeter Seebach <peter.seebach@windriver.com>2015-07-16 13:37:54 -0500
commite84c96eda1618c0db0b89d2a9752270c8fc814f0 (patch)
tree185eef627768519146815582afc4e2118fb7c3ec
parentdb758fb11167c79d9682a17d359568e2a3c4acd5 (diff)
downloadpseudo-e84c96eda1618c0db0b89d2a9752270c8fc814f0.tar.gz
pseudo-e84c96eda1618c0db0b89d2a9752270c8fc814f0.tar.bz2
pseudo-e84c96eda1618c0db0b89d2a9752270c8fc814f0.zip
pseudo.c: Don't truncate xattr data.
In the case where an "oldpath" is actually the data for an xattr operation, don't truncate it. Trailing slashes should only be removed from things which are actually filenames.
-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.
*/