Check setvbuf return value
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Dec 2011 19:05:02 +0000 (13:05 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 1 Feb 2012 12:14:24 +0000 (13:14 +0100)
Check for setvbuf failure.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
blktrace.c

index b14daf20c29cf740415ab7ff2d9f36707060a22d..49cfca61352ddca5233f669e76edb1bea54f84e2 100644 (file)
@@ -2183,7 +2183,10 @@ static int handle_args(int argc, char *argv[])
                piped_output = 1;
                handle_pfds = handle_pfds_entries;
                pfp = stdout;
-               setvbuf(pfp, NULL, _IONBF, 0);
+               if (setvbuf(pfp, NULL, _IONBF, 0)) {
+                       perror("setvbuf stdout");
+                       return 1;
+               }
        } else
                handle_pfds = handle_pfds_file;
        return 0;