logo

utils-std

Collection of commonly available Unix tools
commit: 7952b8cac08004a427072cd04b2214286bcca353
parent d1ec7315a915f5316e669b7abe4cb827ced28469
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 28 Mar 2024 18:58:40 +0100

lib/mode: assert(errno == 0)

Diffstat:

Mlib/mode.c3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/mode.c b/lib/mode.c @@ -126,14 +126,15 @@ new_mode(const char *mode, mode_t old, const char **errstr) if(!symbolic) { - errno = 0; char *endptr = NULL; + assert(errno == 0); long new = strtol(mode, &endptr, 8); if(errno != 0) { *errstr = strerror(errno); + errno = 0; return old; }