From: Arran Cudbard-Bell Date: Sat, 22 Oct 2022 18:22:25 +0000 (-0400) Subject: Returning path - p where p is NULL results in a positive value X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea05bc57bdea30d29d69fd0a7897fcef2a32cce9;p=thirdparty%2Ffreeradius-server.git Returning path - p where p is NULL results in a positive value --- diff --git a/src/lib/util/file.c b/src/lib/util/file.c index 3c24f93aa38..b5202d110c8 100644 --- a/src/lib/util/file.c +++ b/src/lib/util/file.c @@ -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;