use line buffering for traces instead of explicit calls to fflush
[unix-history] / usr / src / usr.sbin / timed / timed / slave.c
index 21fb34b..67a3d3d 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)slave.c    1.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)slave.c    1.3 (Berkeley) %G%";
 #endif not lint
 
 #include "globals.h"
 #endif not lint
 
 #include "globals.h"
@@ -148,16 +148,15 @@ loop:
                case TSP_TRACEON:
                        if (!(trace)) {
                                fd = fopen(fj, "w");
                case TSP_TRACEON:
                        if (!(trace)) {
                                fd = fopen(fj, "w");
+                               setlinebuf(fd);
                                fprintf(fd, "Tracing started on: %s\n\n", 
                                                                date());
                                fprintf(fd, "Tracing started on: %s\n\n", 
                                                                date());
-                               (void)fflush(fd);
                        }
                        trace = ON;
                        break;
                case TSP_TRACEOFF:
                        if (trace) {
                                fprintf(fd, "Tracing ended on: %s\n", date());
                        }
                        trace = ON;
                        break;
                case TSP_TRACEOFF:
                        if (trace) {
                                fprintf(fd, "Tracing ended on: %s\n", date());
-                               (void)fflush(fd);
                                (void)fclose(fd);
                        }
                        trace = OFF;
                                (void)fclose(fd);
                        }
                        trace = OFF;