diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-12-12 23:13:54 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-12-12 23:13:54 +0000 |
commit | f31430166365cccd539d4f16317d9722493106d3 (patch) | |
tree | 5c7c91363ab9f4bfbd29b7d4e2fb4d05e9e74ed5 | |
parent | 3e2b69e027cab627b434a57ab054d6478768e3cf (diff) | |
download | busybox-w32-f31430166365cccd539d4f16317d9722493106d3.tar.gz busybox-w32-f31430166365cccd539d4f16317d9722493106d3.tar.bz2 busybox-w32-f31430166365cccd539d4f16317d9722493106d3.zip |
Fix from Matt Kraai so basename / will work as expected.
git-svn-id: svn://busybox.net/trunk/busybox@1435 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | utility.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1731,14 +1731,16 @@ char *get_last_path_component(char *path) | |||
1731 | char *s=path+strlen(path)-1; | 1731 | char *s=path+strlen(path)-1; |
1732 | 1732 | ||
1733 | /* strip trailing slashes */ | 1733 | /* strip trailing slashes */ |
1734 | while (s && *s == '/') { | 1734 | while (s != path && *s == '/') { |
1735 | *s-- = '\0'; | 1735 | *s-- = '\0'; |
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | /* find last component */ | 1738 | /* find last component */ |
1739 | s = strrchr(path, '/'); | 1739 | s = strrchr(path, '/'); |
1740 | if (s==NULL) return path; | 1740 | if (s == NULL || s[1] == '\0') |
1741 | else return s+1; | 1741 | return path; |
1742 | else | ||
1743 | return s+1; | ||
1742 | } | 1744 | } |
1743 | #endif | 1745 | #endif |
1744 | 1746 | ||