|
|
0f6383 |
From c50d91d16292a13d29b1125c0aa85c7a7963de5f Mon Sep 17 00:00:00 2001
|
|
|
0f6383 |
From: Andreas Schneider <asn@samba.org>
|
|
|
0f6383 |
Date: Mon, 27 Jan 2020 14:58:10 +0100
|
|
|
0f6383 |
Subject: [PATCH] lib:util: Log mkdir error on correct debug levels
|
|
|
0f6383 |
MIME-Version: 1.0
|
|
|
0f6383 |
Content-Type: text/plain; charset=UTF-8
|
|
|
0f6383 |
Content-Transfer-Encoding: 8bit
|
|
|
0f6383 |
|
|
|
0f6383 |
For smbd we want an error and for smbclient we only want it in NOTICE
|
|
|
0f6383 |
debug level.
|
|
|
0f6383 |
The default log level of smbclient is log level 1 so we need notice to
|
|
|
0f6383 |
not spam the user.
|
|
|
0f6383 |
|
|
|
0f6383 |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14253
|
|
|
0f6383 |
|
|
|
0f6383 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
0f6383 |
Reviewed-by: Guenther Deschner <gd@samba.org>
|
|
|
0f6383 |
|
|
|
0f6383 |
Autobuild-User(master): Günther Deschner <gd@samba.org>
|
|
|
0f6383 |
Autobuild-Date(master): Mon Jan 27 15:55:24 UTC 2020 on sn-devel-184
|
|
|
0f6383 |
|
|
|
0f6383 |
(cherry picked from commit 0ad6a243b259d284064c0c5abcc7d430d55be7e1)
|
|
|
0f6383 |
---
|
|
|
0f6383 |
lib/util/util.c | 7 +++++--
|
|
|
0f6383 |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
0f6383 |
|
|
|
0f6383 |
diff --git a/lib/util/util.c b/lib/util/util.c
|
|
|
0f6383 |
index 3bdeded5c1b..0d9ffe5cb7b 100644
|
|
|
0f6383 |
--- a/lib/util/util.c
|
|
|
0f6383 |
+++ b/lib/util/util.c
|
|
|
0f6383 |
@@ -353,9 +353,12 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname,
|
|
|
0f6383 |
old_umask = umask(0);
|
|
|
0f6383 |
ret = mkdir(dname, dir_perms);
|
|
|
0f6383 |
if (ret == -1 && errno != EEXIST) {
|
|
|
0f6383 |
- DBG_WARNING("mkdir failed on directory %s: %s\n",
|
|
|
0f6383 |
+ int dbg_level = geteuid() == 0 ? DBGLVL_ERR : DBGLVL_NOTICE;
|
|
|
0f6383 |
+
|
|
|
0f6383 |
+ DBG_PREFIX(dbg_level,
|
|
|
0f6383 |
+ ("mkdir failed on directory %s: %s\n",
|
|
|
0f6383 |
dname,
|
|
|
0f6383 |
- strerror(errno));
|
|
|
0f6383 |
+ strerror(errno)));
|
|
|
0f6383 |
umask(old_umask);
|
|
|
0f6383 |
return false;
|
|
|
0f6383 |
}
|
|
|
0f6383 |
--
|
|
|
0f6383 |
2.25.0
|
|
|
0f6383 |
|