Changeset 31a4ef41bbf9b94c8ab2584710738251cec46ffe

Show
Ignore:
Timestamp:
02/19/08 15:48:08 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1203436088 +0000
git-parent:

[1648bed76d308479cdd5f492ca2a697c4df97812]

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

fix up the open... appears to work now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/utils/noit_log.c

    r1648bed r31a4ef4  
    44 */ 
    55 
     6#define DEFAULT_JLOG_SUBSCRIBER "stratcond" 
     7 
    68#include "noit_defines.h" 
    79#include <stdio.h> 
    810#include <fcntl.h> 
    911#include <unistd.h> 
     12#include <sys/time.h> 
    1013 
    1114#include "utils/noit_log.h" 
     
    7073  log = jlog_new(ls->path); 
    7174  if(!log) return -1; 
     75  /* Open the writer. */ 
    7276  if(jlog_ctx_open_writer(log)) { 
     77    /* If that fails, we'll give one attempt at initiailizing it. */ 
     78    /* But, since we attempted to open it as a writer, it is tainted. */ 
     79    /* path: close, new, init, close, new, writer, add subscriber */ 
    7380    jlog_ctx_close(log); 
    74     return -1; 
     81    log = jlog_new(ls->path); 
     82    if(jlog_ctx_init(log)) { 
     83      noitL(noit_error, "Cannot init jlog writer: %s\n", 
     84            jlog_ctx_err_string(log)); 
     85      jlog_ctx_close(log); 
     86      return -1; 
     87    } 
     88    /* After it is initialized, we can try to reopen it as a writer. */ 
     89    jlog_ctx_close(log); 
     90    log = jlog_new(ls->path); 
     91    if(jlog_ctx_open_writer(log)) { 
     92      noitL(noit_error, "Cannot open jlog writer: %s\n", 
     93            jlog_ctx_err_string(log)); 
     94      jlog_ctx_close(log); 
     95      return -1; 
     96    } 
     97    /* The first time we open after an init, we should add the subscriber. */ 
     98    jlog_ctx_add_subscriber(log, DEFAULT_JLOG_SUBSCRIBER, JLOG_BEGIN); 
    7599  } 
    76100  ls->op_ctx = log;