]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Returning path - p where p is NULL results in a positive value
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 22 Oct 2022 18:22:25 +0000 (14:22 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 22 Oct 2022 18:22:25 +0000 (14:22 -0400)
src/lib/util/file.c

index 3c24f93aa389dd3fdf66f57eab0d2f1f5d55d51c..b5202d110c8ec341883301e7f96d896a746615dd 100644 (file)
@@ -95,7 +95,7 @@ static ssize_t _fr_mkdir(int *fd_out, char *path, mode_t mode, fr_mkdir_func_t f
         *      error occured.
         */
        p = strrchr(path, FR_DIR_SEP);
-       if (!p || (p == path)) return path - p;
+       if (!p || (p == path)) return 0;        /* Error at index 0 */
 
        *p = '\0';
        if (_fr_mkdir(fd_out, path, mode, func, uctx) <= 0) return path - p;