summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2020-01-27 14:58:10 +0100
committerKarolin Seeger <kseeger@samba.org>2020-01-31 10:41:18 +0000
commit394e414b2dcdac88189eec19f228ac7bae5e3170 (patch)
tree50ad697bfba7a2a2649cdc517573b9eea92bb81a
parent9349e689a865ca36acd379968d2cbd490772bc3b (diff)
downloadsamba-394e414b2dcdac88189eec19f228ac7bae5e3170.tar.gz
lib:util: Log mkdir error on correct debug levels
For smbd we want an error and for smbclient we only want it in NOTICE debug level. The default log level of smbclient is log level 1 so we need notice to not spam the user. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14253 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Mon Jan 27 15:55:24 UTC 2020 on sn-devel-184 (cherry picked from commit 0ad6a243b259d284064c0c5abcc7d430d55be7e1)
-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 3bdeded5c1b..0d9ffe5cb7b 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -353,9 +353,12 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname,
old_umask = umask(0);
ret = mkdir(dname, dir_perms);
if (ret == -1 && errno != EEXIST) {
- DBG_WARNING("mkdir failed on directory %s: %s\n",
+ int dbg_level = geteuid() == 0 ? DBGLVL_ERR : DBGLVL_NOTICE;
+
+ DBG_PREFIX(dbg_level,
+ ("mkdir failed on directory %s: %s\n",
dname,
- strerror(errno));
+ strerror(errno)));
umask(old_umask);
return false;
}