Log function names

This commit is contained in:
Robert Swiecki 2015-05-15 16:42:56 +02:00
parent 69622c17ae
commit ee68cd9d30
4 changed files with 6 additions and 6 deletions

View File

@ -350,7 +350,7 @@ bool containMakeFdsCOE(void)
bool containSetupFD(struct nsjconf_t * nsjconf, int fd_in, int fd_out, int fd_err, int fd_log) bool containSetupFD(struct nsjconf_t * nsjconf, int fd_in, int fd_out, int fd_err, int fd_log)
{ {
/* Make sure all logs go to the parent process from now on */ /* Make sure all logs go to the parent process from now on */
logNewLogFD(fd_log); logRedirectLogFD(fd_log);
if (nsjconf->mode != MODE_LISTEN_TCP) { if (nsjconf->mode != MODE_LISTEN_TCP) {
if (nsjconf->is_silent == false) { if (nsjconf->is_silent == false) {

4
log.c
View File

@ -128,12 +128,12 @@ void logStop(int sig)
LOG_I("Server stops due to fatal signal (%d) caught. Exiting", sig); LOG_I("Server stops due to fatal signal (%d) caught. Exiting", sig);
} }
void logNewLogFD(int fd) void logRedirectLogFD(int fd)
{ {
log_fd = fd; log_fd = fd;
} }
void logDirectly(const char *msg) void logDirectlyToFD(const char *msg)
{ {
dprintf(log_fd, "%s", msg); dprintf(log_fd, "%s", msg);
} }

4
log.h
View File

@ -55,7 +55,7 @@ bool logInitLogFile(struct nsjconf_t *nsjconf, const char *logfile, bool is_verb
void logLog(enum llevel_t ll, const char *fn, int ln, bool perr, const char *fmt, ...) void logLog(enum llevel_t ll, const char *fn, int ln, bool perr, const char *fmt, ...)
__attribute__ ((format(printf, 5, 6))); __attribute__ ((format(printf, 5, 6)));
void logStop(int sig); void logStop(int sig);
void logNewLogFD(int fd); void logRedirectLogFD(int fd);
void logDirectly(const char *msg); void logDirectlyToFD(const char *msg);
#endif /* _LOG_H */ #endif /* _LOG_H */

View File

@ -228,7 +228,7 @@ void subprocRunChild(struct nsjconf_t *nsjconf, int fd_in, int fd_out, int fd_er
ssize_t sz; ssize_t sz;
while ((sz = read(pipefd[0], log_buf, sizeof(log_buf) - 1)) > 0) { while ((sz = read(pipefd[0], log_buf, sizeof(log_buf) - 1)) > 0) {
log_buf[sz] = '\0'; log_buf[sz] = '\0';
logDirectly(log_buf); logDirectlyToFD(log_buf);
} }
close(pipefd[0]); close(pipefd[0]);
close(pipefd[1]); close(pipefd[1]);