summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-03-14 10:46:14 +0100
committerStefan Metzmacher <metze@samba.org>2012-03-14 12:00:46 +0100
commite03059fc96931416c551d7d0a30eccb727a4f524 (patch)
treee74d1dbc1c7e9e4c0052812b93e17e89a7f99ecb /lib
parentf30626111994c0a5a4b886f52de1f62bfc52de3c (diff)
downloadsamba-e03059fc96931416c551d7d0a30eccb727a4f524.tar.gz
samba-e03059fc96931416c551d7d0a30eccb727a4f524.tar.bz2
samba-e03059fc96931416c551d7d0a30eccb727a4f524.zip
lib/util: use a helper variable in directory_create_or_exist()
metze
Diffstat (limited to 'lib')
-rw-r--r--lib/util/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index 54237c57d8..54a8c88245 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -145,11 +145,13 @@ _PUBLIC_ bool directory_exist(const char *dname)
_PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid,
mode_t dir_perms)
{
+ int ret;
mode_t old_umask;
struct stat st;
old_umask = umask(0);
- if (lstat(dname, &st) == -1) {
+ ret = lstat(dname, &st);
+ if (ret == -1) {
if (errno != ENOENT) {
DEBUG(0, ("lstat failed on directory %s: %s\n",
dname, strerror(errno)));
@@ -158,7 +160,8 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid,
}
/* Create directory */
- if (mkdir(dname, dir_perms) == -1) {
+ ret = mkdir(dname, dir_perms);
+ if (ret == -1) {
DEBUG(0, ("mkdir failed on directory "
"%s: %s\n", dname,
strerror(errno)));