Closing stdin makes sense, but I still want to see error messages from
the program I'm running.  Since arbitrary progams can be run, keep both
stdout and stderr open so users get a chance to actually notice program
failure or maybe even use output for good.

In a common setup where xidle(1) is started from ~/.xsession, I'd expect
errors to pop up in ~/.xsession-errors.

OK?

Index: xidle.c
===================================================================
RCS file: /cvs/xenocara/app/xidle/xidle.c,v
retrieving revision 1.6
diff -u -p -r1.6 xidle.c
--- xidle.c     6 Sep 2018 07:21:34 -0000       1.6
+++ xidle.c     3 Nov 2018 19:54:41 -0000
@@ -362,12 +362,10 @@ main(int argc, char **argv)
        signal(SIGTERM, handler);
        signal(SIGUSR1, handler);
 
-       fd = open(_PATH_DEVNULL, O_RDWR, 0);
+       fd = open(_PATH_DEVNULL, O_RDONLY, 0);
        if (fd < 0)
                err(1, _PATH_DEVNULL);
        dup2(fd, STDIN_FILENO);
-       dup2(fd, STDOUT_FILENO);
-       dup2(fd, STDERR_FILENO);
        if (fd > 2)
                close(fd);
 

Reply via email to