Skip to contentSkip to conversation

Check setvbuf return value

PATCH New Eric Sandeen 1 participant 1 message Dec 16, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 Check setvbuf return value

Check for setvbuf failure.

---

blktrace.c +4 -1
index 72866e2..848250d 100644
@@ -2178,7 +2178,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;