diff options
Diffstat (limited to 'fish/copy.c')
-rw-r--r-- | fish/copy.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fish/copy.c b/fish/copy.c index 789e430d..944f4ccb 100644 --- a/fish/copy.c +++ b/fish/copy.c @@ -148,11 +148,14 @@ split_path (char *buf, size_t buf_size, } char *p = strrchr (buf, '/'); - if (p && p > buf) { + if (p && p > buf) { /* "foo/bar" */ *p = '\0'; p++; if (dirname) *dirname = buf; if (basename) *basename = p; + } else if (p && p == buf) { /* "/foo" */ + if (dirname) *dirname = bad_cast ("/"); + if (basename) *basename = buf+1; } else { if (dirname) *dirname = NULL; if (basename) *basename = buf; |