URI: 
       tRedirect stdout and stderr to logfile - ltk - Socket-based GUI for X11 (WIP)
  HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/git/ltk.git (encrypted, but very slow)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit b411a0c6e0d45f347be63ffb40dc62092ab8c3c1
   DIR parent 6b197acfae171f5db4ef485cf5fc503287c52752
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Sat, 30 Jan 2021 20:20:23 +0100
       
       Redirect stdout and stderr to logfile
       
       Diffstat:
         M ltkd.c                              |      12 ++++++++----
       
       1 file changed, 8 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/ltkd.c b/ltkd.c
       t@@ -302,12 +302,16 @@ daemonize(void) {
                if (chdir("/") < 0)
                        ltk_fatal_errno("Can't change directory to root.\n");
        
       +        /* FIXME: why didn't I just use fclose() here? */
       +        /* FIXME: just print log to stdout and let this take care of redirection */
                close(fileno(stdin));
       -        close(fileno(stdout));
       -        close(fileno(stderr));
       +        /*close(fileno(stdout));
       +        close(fileno(stderr));*/
                open("/dev/null", O_RDWR);
       -        dup(0);
       -        dup(0);
       +        /*dup(0);
       +        dup(0);*/
       +        dup2(fileno(ltk_logfile), fileno(stdout));
       +        dup2(fileno(ltk_logfile), fileno(stderr));
        
                /* FIXME: Is it guaranteed that this will work? Will these fds
                   always be opened on the lowest numbers? */