]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:util: Log mkdir error on correct debug levels
authorAndreas Schneider <asn@samba.org>
Mon, 27 Jan 2020 13:58:10 +0000 (14:58 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 3 Feb 2020 14:10:49 +0000 (14:10 +0000)
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)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Mon Feb  3 14:10:49 UTC 2020 on sn-devel-144

lib/util/util.c

index dc1772c839e5a8d802d85b9534412038b5bc25ff..3a1c8738581216e2f962f9b96b5d591b61635748 100644 (file)
@@ -200,9 +200,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;
        }