summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-10-16 12:15:43 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-10-18 09:02:24 +0200
commitc41dfceb951b795357a014205faebac2853f7c02 (patch)
treeca80fb7dc8912779b3143b9d163e61fb1aa9fe3f /lib
parent3e06eceaf441cfbe02dc4c436dc77ac28a0e5cb9 (diff)
downloadbarebox-c41dfceb951b795357a014205faebac2853f7c02.tar.gz
linux: string: Port kbasename()
Port kbasename() from Linux and use it to implement basename() we already have. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/libgen.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/libgen.c b/lib/libgen.c
index 08ef3528af..61a8670fb5 100644
--- a/lib/libgen.c
+++ b/lib/libgen.c
@@ -17,23 +17,11 @@
#include <common.h>
#include <libgen.h>
+#include <linux/string.h>
char *basename (char *path)
{
- char *fname;
-
- if(!strchr(path, '/'))
- return path;
-
- fname = path + strlen(path) - 1;
- while (fname >= path) {
- if (*fname == '/') {
- fname++;
- break;
- }
- fname--;
- }
- return fname;
+ return (char *)kbasename(path);
}
EXPORT_SYMBOL(basename);