From: Volker Lendecke Date: Fri, 23 Apr 2021 14:37:31 +0000 (+0200) Subject: lib: Remove close_low_fds() X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=349bd015d227a625990af7122e39319431f7af8d;p=kseeger%2Fsamba-autobuild%2F.git lib: Remove close_low_fds() There were only two callers, it did not do proper error handling, and it was confusing to call. Signed-off-by: Volker Lendecke Reviewed-by: Andreas Schneider --- diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c index f89ca7f27cf..984d4a82bcc 100644 --- a/lib/util/become_daemon.c +++ b/lib/util/become_daemon.c @@ -45,33 +45,6 @@ void daemon_sd_notifications(bool enable) sd_notifications ? "enabled" : "disabled"); } -/******************************************************************* - Close the low 3 fd's and open dev/null in their place. -********************************************************************/ - -void close_low_fds(bool stdin_too, bool stdout_too, bool stderr_too) -{ - - if (stdin_too) { - int ret = close_low_fd(0); - if (ret != 0) { - DBG_ERR("close_low_fd(0) failed: %s\n", strerror(ret)); - } - } - if (stdout_too) { - int ret = close_low_fd(1); - if (ret != 0) { - DBG_ERR("close_low_fd(1) failed: %s\n", strerror(ret)); - } - } - if (stderr_too) { - int ret = close_low_fd(2); - if (ret != 0) { - DBG_ERR("close_low_fd(2) failed: %s\n", strerror(ret)); - } - } -} - /**************************************************************************** Become a daemon, discarding the controlling terminal. ****************************************************************************/ diff --git a/lib/util/become_daemon.h b/lib/util/become_daemon.h index 149d4c0175e..e12be27246b 100644 --- a/lib/util/become_daemon.h +++ b/lib/util/become_daemon.h @@ -32,15 +32,6 @@ * @brief Utilities for demonising */ -/** - * @brief Close the low 3 file descriptors and open /dev/null in their place - * - * @param[in] stdin_too Should stdin be closed? - * @param[in] stdout_too Should stdout be closed? - * @param[in] stderr_too Should stderr be closed? -**/ -void close_low_fds(bool stdin_too, bool stdout_too, bool stderr_too); - /** * @brief Enable or disable daemon status systemd notifications *