diff options
author | root <root@rshg054.dnsready.net> | 2012-02-25 23:15:06 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-02-25 23:15:06 +0000 |
commit | e4a5730eb358cb0d78bc022204ddccac068c2bf2 (patch) | |
tree | 8dc9d2ac6b1313cb68be1a6c8b51500397f8b225 /testing/util-linux/lib-canonicalize-always-remove-tailing-slash.patch | |
parent | 299e917c17619f800f0c21cf43209065b608223f (diff) |
Sat Feb 25 23:15:06 UTC 2012
Diffstat (limited to 'testing/util-linux/lib-canonicalize-always-remove-tailing-slash.patch')
-rw-r--r-- | testing/util-linux/lib-canonicalize-always-remove-tailing-slash.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/util-linux/lib-canonicalize-always-remove-tailing-slash.patch b/testing/util-linux/lib-canonicalize-always-remove-tailing-slash.patch new file mode 100644 index 000000000..3b830a2ad --- /dev/null +++ b/testing/util-linux/lib-canonicalize-always-remove-tailing-slash.patch @@ -0,0 +1,37 @@ +From 28074a0952469aebf021821d95238cfb964d13ff Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Fri, 24 Feb 2012 21:26:11 +0100 +Subject: [PATCH 09/12] lib/canonicalize: always remove tailing slash + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + lib/canonicalize.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/lib/canonicalize.c b/lib/canonicalize.c +index ab32c10..fd18af4 100644 +--- a/lib/canonicalize.c ++++ b/lib/canonicalize.c +@@ -174,9 +174,16 @@ canonicalize_path(const char *path) + if (path == NULL) + return NULL; + +- if (!myrealpath(path, canonical, PATH_MAX+1)) +- return strdup(path); +- ++ 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; ++ } + + p = strrchr(canonical, '/'); + if (p && strncmp(p, "/dm-", 4) == 0 && isdigit(*(p + 4))) { +-- +1.7.9.2 + |