]> git.notmuchmail.org Git - notmuch/blobdiff - lib/database.cc
lib: fix handling of one character long directory names at top level
[notmuch] / lib / database.cc
index 3b342f136a5397b32096987d0ad3592c43e4fc63..b8486f7d5271771648ef0ff1ec71c8887a43b391 100644 (file)
@@ -1781,7 +1781,7 @@ _notmuch_database_split_path (void *ctx,
 
     /* Finally, skip multiple slashes. */
     while (slash != path) {
-       if (*slash != '/')
+       if (*(slash - 1) != '/')
            break;
 
        --slash;
@@ -1794,7 +1794,7 @@ _notmuch_database_split_path (void *ctx,
            *basename = path;
     } else {
        if (directory)
-           *directory = talloc_strndup (ctx, path, slash - path + 1);
+           *directory = talloc_strndup (ctx, path, slash - path);
     }
 
     return NOTMUCH_STATUS_SUCCESS;