Loading sld/trunk/src/daemon.hh +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ public: bool operator()(const Job &a, const Job &b); }; inline bool verbose() const { return options.verbose == 1; } inline bool verbose() const { return options.verbose == 2; } Options options; Loading sld/trunk/src/options.cc +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ Options &Options::getoptions(int argc, char *argv[]) { throw Error(ERR_USAGE); } else if (!strcmp(argv[i], "-v")) { this->verbose = 1; this->verbose = 2; } else if (!strcmp(argv[i], "-q")) { this->verbose = 0; Loading sld/trunk/src/sld.cc +15 −0 Original line number Diff line number Diff line #include <signal.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string> Loading Loading @@ -43,6 +45,18 @@ int main(int argc, char *argv[]) delete lineopt; // dup on quiet mode if (daemon.options.verbose == 0) { int dn = open("/dev/null", O_RDWR); if (dn == -1) { perror("sld: open(/dev/null, O_RDWR)"); return ERR_UNKNOWN; } dup2(dn, STDOUT_FILENO); dup2(dn, STDERR_FILENO); close(dn); } // register sigchild handler if (signal(SIGCHLD, sigchild) == SIG_ERR) { perror("sld: error"); Loading Loading @@ -89,6 +103,7 @@ static Options get_default_options() { options.retrydelay = 60; options.daemon = 0; options.closefd = 1; options.verbose = 1; return options; } Loading Loading
sld/trunk/src/daemon.hh +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ public: bool operator()(const Job &a, const Job &b); }; inline bool verbose() const { return options.verbose == 1; } inline bool verbose() const { return options.verbose == 2; } Options options; Loading
sld/trunk/src/options.cc +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ Options &Options::getoptions(int argc, char *argv[]) { throw Error(ERR_USAGE); } else if (!strcmp(argv[i], "-v")) { this->verbose = 1; this->verbose = 2; } else if (!strcmp(argv[i], "-q")) { this->verbose = 0; Loading
sld/trunk/src/sld.cc +15 −0 Original line number Diff line number Diff line #include <signal.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string> Loading Loading @@ -43,6 +45,18 @@ int main(int argc, char *argv[]) delete lineopt; // dup on quiet mode if (daemon.options.verbose == 0) { int dn = open("/dev/null", O_RDWR); if (dn == -1) { perror("sld: open(/dev/null, O_RDWR)"); return ERR_UNKNOWN; } dup2(dn, STDOUT_FILENO); dup2(dn, STDERR_FILENO); close(dn); } // register sigchild handler if (signal(SIGCHLD, sigchild) == SIG_ERR) { perror("sld: error"); Loading Loading @@ -89,6 +103,7 @@ static Options get_default_options() { options.retrydelay = 60; options.daemon = 0; options.closefd = 1; options.verbose = 1; return options; } Loading