File: line-buffered.patch

package info (click to toggle)
ucspi-unix 1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 452 kB
  • sloc: ansic: 2,606; python: 535; makefile: 14; sh: 1
file content (39 lines) | stat: -rw-r--r-- 824 bytes parent folder | download | duplicates (3)
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)