]> granicus.if.org Git - sysstat/blobdiff - cifsiostat.c
sar/sadc: Dereference nr array pointer in struct activity
[sysstat] / cifsiostat.c
index 62488d120ea839578c00b266368f1045d7592425..52e9cabd8516944b3eb3c837f18379935ad56289 100644 (file)
@@ -449,9 +449,6 @@ void rw_io_stat_loop(long int count, struct tm *rectime)
        sigaction(SIGALRM, &alrm_act, NULL);
        alarm(interval);
 
-       /* Don't buffer data if redirected to a pipe */
-       setbuf(stdout, NULL);
-
        do {
                /* Every device is potentially nonexistent */
                set_cifs_nonexistent(cifs_list);
@@ -605,6 +602,13 @@ int main(int argc, char **argv)
 
        get_localtime(&rectime, 0);
 
+       /*
+        * Don't buffer data if redirected to a pipe.
+        * Note: With musl-c, the behavior of this function is undefined except
+        * when it is the first operation on the stream.
+        */
+       setbuf(stdout, NULL);
+
        /* Get system name, release number and hostname */
        __uname(&header);
        if (print_gal_header(&rectime, header.sysname, header.release,