diff options
author | Karel Zak | 2012-03-26 10:08:48 +0200 |
---|---|---|
committer | Karel Zak | 2012-03-26 10:08:48 +0200 |
commit | 225b804b6652902ecc0dbf2dc9311640cd55ee83 (patch) | |
tree | 066f324febb0815b98373d41591335f99db10c2c /lib/canonicalize.c | |
parent | hexdump: update man page for -n and -s (diff) | |
download | kernel-qcow2-util-linux-225b804b6652902ecc0dbf2dc9311640cd55ee83.tar.gz kernel-qcow2-util-linux-225b804b6652902ecc0dbf2dc9311640cd55ee83.tar.xz kernel-qcow2-util-linux-225b804b6652902ecc0dbf2dc9311640cd55ee83.zip |
Revert "lib/canonicalize: always remove tailing slash"
It's overkill to modify unknown paths in a generic function like
canonicalize_path().
for example:
mount -t fuse 'sshfs#marty@thee:/' /media/thee
will be canonicalized to
mount -t fuse 'sshfs#marty@thee:' /media/thee
and this obvious bug.
Reported-by: Martin Panter <vadmium+floss@gmail.com>
This reverts commit 28074a0952469aebf021821d95238cfb964d13ff.
Diffstat (limited to 'lib/canonicalize.c')
-rw-r--r-- | lib/canonicalize.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/canonicalize.c b/lib/canonicalize.c index fd18af42c..ab32c1043 100644 --- a/lib/canonicalize.c +++ b/lib/canonicalize.c @@ -174,16 +174,9 @@ canonicalize_path(const char *path) if (path == NULL) return NULL; - if (!myrealpath(path, canonical, PATH_MAX+1)) { - char *res = strdup(path); - if (res) { - p = strrchr(res, '/'); - /* delete trailing slash */ - if (p && p > res && *(p + 1) == '\0') - *p = '\0'; - } - return res; - } + if (!myrealpath(path, canonical, PATH_MAX+1)) + return strdup(path); + p = strrchr(canonical, '/'); if (p && strncmp(p, "/dm-", 4) == 0 && isdigit(*(p + 4))) { |