Skip to content

Commit

Permalink
After daemonizing reopen the output file.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Sep 28, 2023
1 parent 1186863 commit f837124
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/icewmbg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <stdlib.h>
#include <X11/Xatom.h>
Expand Down Expand Up @@ -1292,8 +1290,12 @@ int main(int argc, char **argv) {
if (trans.nonempty())
trans.clear();

if (daemonize)
daemon(1, 0);
if (daemonize) {
if (daemon(1, 0) == -1)
fail("daemon");
if (nonempty(outputArg))
upath::redirectOutput(outputArg);
}

return bg.mainLoop();
}
Expand Down

0 comments on commit f837124

Please sign in to comment.