summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/file.c b/file.c
index 0894c72ffb..db21a3588a 100644
--- a/file.c
+++ b/file.c
@@ -1375,6 +1375,8 @@ file_s_dirname(obj, fname)
if (!p) {
return str_new2(".");
}
+ if (p == fname->ptr)
+ p++;
return str_taint(str_new(fname->ptr, p - fname->ptr));
}