Changeset 31a4ef41bbf9b94c8ab2584710738251cec46ffe
- Timestamp:
- 02/19/08 15:48:08
(10 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
r1648bed |
r31a4ef4 |
|
4 | 4 | */ |
---|
5 | 5 | |
---|
| 6 | #define DEFAULT_JLOG_SUBSCRIBER "stratcond" |
---|
| 7 | |
---|
6 | 8 | #include "noit_defines.h" |
---|
7 | 9 | #include <stdio.h> |
---|
8 | 10 | #include <fcntl.h> |
---|
9 | 11 | #include <unistd.h> |
---|
| 12 | #include <sys/time.h> |
---|
10 | 13 | |
---|
11 | 14 | #include "utils/noit_log.h" |
---|
… | … | |
70 | 73 | log = jlog_new(ls->path); |
---|
71 | 74 | if(!log) return -1; |
---|
| 75 | /* Open the writer. */ |
---|
72 | 76 | 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 */ |
---|
73 | 80 | 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); |
---|
75 | 99 | } |
---|
76 | 100 | ls->op_ctx = log; |
---|