Changeset 6de8198aa4e7b27e09a9a6b83c160510c78c9cd0

Show
Ignore:
Timestamp:
02/04/10 02:03:23 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1265249003 +0000
git-parent:

[9773c9f2c8f4413f348fed53ebb19681bfdfd074]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1265249003 +0000
Message:

closes #250

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_conf.c

    rd857961 r6de8198  
    776776    outlets = noit_conf_get_sections(log_configs[i], 
    777777                                     "ancestor-or-self::node()/outlet", &ocnt); 
    778     noitL(noit_debug, "Found %d outlets for log '%s'\n", ocnt, name); 
     778    noitL(noit_error, "Found %d outlets for log '%s'\n", ocnt, name); 
    779779 
    780780    for(o=0; o<ocnt; o++) { 
  • src/noitd.c

    r13c6915 r6de8198  
    260260 
    261261int main(int argc, char **argv) { 
     262  int fd; 
    262263  char conf_str[1024]; 
    263264  char user[32], group[32]; 
     
    317318  if(foreground) return child_main(); 
    318319 
    319   close(STDIN_FILENO); 
    320   close(STDOUT_FILENO); 
    321   close(STDERR_FILENO); 
     320  open("/dev/null", O_RDWR); 
     321  dup2(fd, STDIN_FILENO); 
     322  dup2(fd, STDOUT_FILENO); 
     323  dup2(fd, STDERR_FILENO); 
    322324  if(fork()) exit(0); 
    323325  setsid(); 
  • src/stratcond.c

    rd94c4d2 r6de8198  
    271271 
    272272int main(int argc, char **argv) { 
     273  int fd; 
    273274  parse_clargs(argc, argv); 
    274275 
     
    282283  if(foreground) exit(child_main()); 
    283284 
    284   close(STDIN_FILENO); 
    285   close(STDOUT_FILENO); 
    286   close(STDERR_FILENO); 
     285  fd = open("/dev/null", O_RDWR); 
     286  dup2(fd, STDIN_FILENO); 
     287  dup2(fd, STDOUT_FILENO); 
     288  dup2(fd, STDERR_FILENO); 
    287289  if(fork()) exit(0); 
    288290  setsid(); 
  • src/utils/noit_log.c

    r3fe9ac2 r6de8198  
    5858#endif 
    5959 
     60static int DEBUG_LOG_ENABLED() { 
     61  static int enabled = -1; 
     62  if(enabled == -1) { 
     63    char *env = getenv("NOIT_LOG_DEBUG"); 
     64    enabled = env ? atoi(env) : 0; 
     65  } 
     66  return enabled; 
     67} 
     68#define debug_printf(a...) do { \ 
     69  if(DEBUG_LOG_ENABLED()) fprintf(stderr, a); \ 
     70} while(0) 
     71 
    6072struct _noit_log_stream { 
    6173  unsigned enabled:1; 
     
    88100  ls->mode = 0664; 
    89101  fd = open(ls->path, O_CREAT|O_WRONLY|O_APPEND, ls->mode); 
     102  debug_printf("opened '%s' => %d\n", ls->path, fd); 
    90103  if(fd < 0) { 
    91104    ls->op_ctx = NULL; 
     
    113126  int fd; 
    114127  fd = (int)(vpsized_int)ls->op_ctx; 
     128  debug_printf("writing to %d\n", fd); 
    115129  if(fd < 0) return -1; 
    116130  return write(fd, buf, len); 
     
    550564  for(node = ls->outlets; node; node = node->next) { 
    551565    int srv = 0; 
     566    debug_printf(" %s -> %s\n", ls->name, node->outlet->name); 
    552567    srv = noit_log_line(node->outlet, buffer, len); 
    553568    if(srv) rv = srv;