From: didg Date: Tue, 2 Dec 2008 02:17:43 +0000 (+0000) Subject: volinfo: test chdir return value X-Git-Tag: netatalk-2-0-4-beta1~8 X-Git-Url: https://arthur.barton.de/gitweb/?p=netatalk.git;a=commitdiff_plain;h=00b7bd5cc2e8453b607f85051699e4a279af906f volinfo: test chdir return value --- diff --git a/libatalk/util/volinfo.c b/libatalk/util/volinfo.c index ac1e61d0..646438b3 100644 --- a/libatalk/util/volinfo.c +++ b/libatalk/util/volinfo.c @@ -152,13 +152,13 @@ static char * make_path_absolute(char *path, size_t bufsize) *p = '\0'; } - getcwd(savecwd, sizeof(savecwd)); - if ((chdir(abspath)) < 0) + if (!getcwd(savecwd, sizeof(savecwd)) || chdir(abspath) < 0) return NULL; - getcwd(abspath, sizeof(abspath)); - chdir (savecwd); - + if (!getcwd(abspath, sizeof(abspath)) || chdir (savecwd) < 0) + return NULL; + + if (strlen(abspath) > bufsize) return NULL;