lib: Remove close_low_fds()
authorVolker Lendecke <vl@samba.org>
Fri, 23 Apr 2021 14:37:31 +0000 (16:37 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 27 Apr 2021 13:24:35 +0000 (13:24 +0000)
There were only two callers, it did not do proper error handling, and
it was confusing to call.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/util/become_daemon.c
lib/util/become_daemon.h

index f89ca7f27cf9278c37032ef65cb78860a84d61ab..984d4a82bcc899f6c99452be1494393d01834877 100644 (file)
@@ -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.
 ****************************************************************************/
index 149d4c0175ee01ae0c0938296b8a126fb36b4885..e12be27246bfd8b204ad7c65cfa538600ad50ec1 100644 (file)
  * @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
  *