flush fprintf

This commit is contained in:
springzfx
2020-05-29 16:16:32 +08:00
parent c32457a1aa
commit af78ad2012
2 changed files with 7 additions and 3 deletions

View File

@@ -44,7 +44,10 @@ bool loadExecsnoopLib() {
}
info("dlsym startThread success");
return true;
} catch (exception &e) { return false; }
} catch (exception &e) {
debug("exception: %s",e.what());
return false;
}
}
} // namespace CGPROXY::EXECSNOOP
@@ -253,7 +256,6 @@ public:
execsnoop_thread_id = startExecsnoopThread();
if (execsnoop_thread_id > 0) info("execsnoop thread started");
}
cout << flush;
pthread_join(socket_thread_id, NULL);
pthread_join(execsnoop_thread_id, NULL);
@@ -295,7 +297,6 @@ void processArgs(const int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
setbuf(stdout, NULL);
processArgs(argc, argv);
if (print_help) {
print_usage();

View File

@@ -46,6 +46,7 @@ extern bool enable_info;
fprintf(stderr, "error: "); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
fflush(stderr); \
}
#define debug(...) \
@@ -53,6 +54,7 @@ extern bool enable_info;
fprintf(stdout, "debug: "); \
fprintf(stdout, __VA_ARGS__); \
fprintf(stdout, "\n"); \
fflush(stdout); \
}
#define info(...) \
@@ -60,6 +62,7 @@ extern bool enable_info;
fprintf(stdout, "info: "); \
fprintf(stdout, __VA_ARGS__); \
fprintf(stdout, "\n"); \
fflush(stdout); \
}
#define return_error return -1