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.
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))) {