projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e48eea6
)
Fix from Matt Kraai so basename / will work as expected.
author
Eric Andersen
<andersen@codepoet.org>
Tue, 12 Dec 2000 23:13:54 +0000
(23:13 -0000)
committer
Eric Andersen
<andersen@codepoet.org>
Tue, 12 Dec 2000 23:13:54 +0000
(23:13 -0000)
utility.c
patch
|
blob
|
history
diff --git
a/utility.c
b/utility.c
index 879677726e1c6ef6e2d029ee574d384a52056a42..0e170d1c182e69321b05114ac4ab583776ff4455 100644
(file)
--- a/
utility.c
+++ b/
utility.c
@@
-1731,14
+1731,16
@@
char *get_last_path_component(char *path)
char *s=path+strlen(path)-1;
/* strip trailing slashes */
- while (s && *s == '/') {
+ while (s
!= path
&& *s == '/') {
*s-- = '\0';
}
/* find last component */
s = strrchr(path, '/');
- if (s==NULL) return path;
- else return s+1;
+ if (s == NULL || s[1] == '\0')
+ return path;
+ else
+ return s+1;
}
#endif