aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/basename.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/basename.c b/toys/posix/basename.c
index 1a27a23b..c123cc79 100644
--- a/toys/posix/basename.c
+++ b/toys/posix/basename.c
@@ -23,7 +23,7 @@ void basename_main(void)
char *base = basename(*toys.optargs), *suffix = toys.optargs[1];
// chop off the suffix if provided
- if (suffix) {
+ if (suffix && *suffix) {
long bl = strlen(base), sl = strlen(suffix);
char *s = base + bl - sl;