From 225b804b6652902ecc0dbf2dc9311640cd55ee83 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 26 Mar 2012 10:08:48 +0200 Subject: 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 This reverts commit 28074a0952469aebf021821d95238cfb964d13ff. --- lib/canonicalize.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib/canonicalize.c') 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))) { -- cgit v1.2.3-55-g7522