mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-03 13:37:14 +08:00
314d3a38c6
mkinitcpio-busybox: bump to 1.19.4 mkinitcpio: bump to 0.8.3
38 lines
996 B
Diff
38 lines
996 B
Diff
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
|
|
|