From 7061de26fa038719b70f6fdf971acf8ff807fd2f Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Thu, 18 Jun 2015 10:36:37 -0400 Subject: Revert "udev: don't close std{in,out,err}" This reverts commit b2399d9b7222abe7db8ab4bc16e0efe3ccae4c42. This solves issue #108. While upstream also reverted this commit, they did so using functions in terminal-util.c. We could import that file and those functions but for such a small commit, its not worth it. We may do so at some future time if there are further gains. See: https://github.com/systemd/systemd/commit/40e749b59ba49fb97c1f45859debe2a82bc9c9ef Signed-off-by: Anthony G. Basile --- src/udev/udevd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 6cfb2bcfc..f4076b135 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1277,6 +1277,18 @@ int main(int argc, char *argv[]) { udev_list_node_init(&event_list); + if (!arg_debug) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + } + } + fd_inotify = udev_watch_init(udev); if (fd_inotify < 0) { r = log_error_errno(ENOMEM, "error initializing inotify"); -- cgit v1.2.3-65-gdbad