git.samba.org
/
samba.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
s3: util: Do not take over stderr when there is no log file
[samba.git]
/
lib
/
util
/
debug.c
diff --git
a/lib/util/debug.c
b/lib/util/debug.c
index 141f3a595cada3fe0e405917c9b2029a423ea852..d41e0f99c7703e0498a5929749c7f16f49462459 100644
(file)
--- a/
lib/util/debug.c
+++ b/
lib/util/debug.c
@@
-1077,8
+1077,11
@@
bool reopen_logs_internal(void)
force_check_log_size();
(void)umask(oldumask);
force_check_log_size();
(void)umask(oldumask);
- /* Take over stderr to catch output into logs */
- if (state.fd > 0) {
+ /*
+ * If log file was opened or created successfully, take over stderr to
+ * catch output into logs.
+ */
+ if (new_fd != -1) {
if (dup2(state.fd, 2) == -1) {
/* Close stderr too, if dup2 can't point it -
at the logfile. There really isn't much
if (dup2(state.fd, 2) == -1) {
/* Close stderr too, if dup2 can't point it -
at the logfile. There really isn't much