1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
Description: Flush the standard output stream after logging a line
Make it possible for a parent process to read log lines as they come.
Forwarded: not-needed
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2023-01-05
--- a/unixserver.c
+++ b/unixserver.c
@@ -67,21 +67,27 @@
void log_status(void)
{
- if(opt_verbose)
+ if(opt_verbose) {
printf("unixserver: status: %d/%d\n", forked, opt_connections);
+ fflush(stdout);
+ }
}
void log_child_exit(pid_t pid, int status)
{
- if(opt_verbose)
+ if(opt_verbose) {
printf("unixserver: end %d status %d\n", pid, status);
+ fflush(stdout);
+ }
log_status();
}
void log_child_start(pid_t pid)
{
- if(opt_verbose)
+ if(opt_verbose) {
printf("unixserver: pid %d\n", pid);
+ fflush(stdout);
+ }
}
void die(const char* msg)
|