|
a/src/utils/debuglog.cpp |
|
b/src/utils/debuglog.cpp |
|
... |
|
... |
19 |
#define __USE_GNU
|
19 |
#define __USE_GNU
|
20 |
#include <stdio.h>
|
20 |
#include <stdio.h>
|
21 |
#include <stdarg.h>
|
21 |
#include <stdarg.h>
|
22 |
#include <stdlib.h>
|
22 |
#include <stdlib.h>
|
23 |
#include <string.h>
|
23 |
#include <string.h>
|
|
|
24 |
#include <fcntl.h>
|
24 |
|
25 |
|
25 |
#ifdef INCLUDE_NEW_H
|
26 |
#ifdef INCLUDE_NEW_H
|
26 |
#include <new.h>
|
27 |
#include <new.h>
|
27 |
#endif
|
28 |
#endif
|
28 |
|
29 |
|
|
... |
|
... |
82 |
fp = stdout;
|
83 |
fp = stdout;
|
83 |
} else if (!strcmp(filename, "stderr")) {
|
84 |
} else if (!strcmp(filename, "stderr")) {
|
84 |
fp = stderr;
|
85 |
fp = stderr;
|
85 |
} else {
|
86 |
} else {
|
86 |
fp = fopen(filename, (truncate) ? "w" : "a");
|
87 |
fp = fopen(filename, (truncate) ? "w" : "a");
|
87 |
if (fp)
|
88 |
if (fp) {
|
88 |
setvbuf(fp, 0, _IOLBF, 0);
|
89 |
setvbuf(fp, 0, _IOLBF, 0);
|
|
|
90 |
#ifdef O_APPEND
|
|
|
91 |
{
|
|
|
92 |
int flgs = 0;
|
|
|
93 |
fcntl(fileno(fp), F_GETFL, &flgs);
|
|
|
94 |
fcntl(fileno(fp), F_SETFL, flgs|O_APPEND);
|
|
|
95 |
}
|
|
|
96 |
#endif
|
|
|
97 |
}
|
89 |
}
|
98 |
}
|
90 |
return;
|
99 |
return;
|
91 |
}
|
100 |
}
|
92 |
|
101 |
|
93 |
void maybeclosefp() {
|
102 |
void maybeclosefp() {
|