mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
smbd: Replace call to close_low_fds() with direct calls
Check the errors from close_low_fd(). Also, close_low_fds() does not really add a lot of value, for example there's no caller that closes stderr. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
8d2eb62a10
commit
8728bf9147
@ -24,6 +24,7 @@
|
||||
#include "includes.h"
|
||||
#include "system/filesys.h"
|
||||
#include "lib/util/server_id.h"
|
||||
#include "lib/util/close_low_fd.h"
|
||||
#include "popt_common.h"
|
||||
#include "locking/share_mode_lock.h"
|
||||
#include "smbd/smbd.h"
|
||||
@ -2159,7 +2160,7 @@ extern void build_options(bool screen);
|
||||
}
|
||||
|
||||
if (!is_daemon) {
|
||||
int sock;
|
||||
int ret, sock;
|
||||
|
||||
/* inetd mode */
|
||||
TALLOC_FREE(frame);
|
||||
@ -2170,7 +2171,19 @@ extern void build_options(bool screen);
|
||||
sock = dup(0);
|
||||
|
||||
/* close stdin, stdout (if not logging to it), but not stderr */
|
||||
close_low_fds(true, !debug_get_output_is_stdout(), false);
|
||||
ret = close_low_fd(0);
|
||||
if (ret != 0) {
|
||||
DBG_ERR("close_low_fd(0) failed: %s\n", strerror(ret));
|
||||
return 1;
|
||||
}
|
||||
if (!debug_get_output_is_stdout()) {
|
||||
ret = close_low_fd(1);
|
||||
if (ret != 0) {
|
||||
DBG_ERR("close_low_fd(1) failed: %s\n",
|
||||
strerror(ret));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_ATEXIT
|
||||
atexit(killkids);
|
||||
|
Loading…
Reference in New Issue
Block a user