[systemd-devel] [PATCH 2/2] bootchart: check return of fopen before setvbuf in log.c

Lukas Nykryn lnykryn at redhat.com
Wed Jan 9 08:10:57 PST 2013


---
 src/bootchart/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bootchart/log.c b/src/bootchart/log.c
index 89c7b35..6c40913 100644
--- a/src/bootchart/log.c
+++ b/src/bootchart/log.c
@@ -364,9 +364,9 @@ schedstat_next:
 		if (!ps->smaps) {
 			sprintf(filename, "/proc/%d/smaps", pid);
 			ps->smaps = fopen(filename, "r");
-			setvbuf(ps->smaps, smaps_buf, _IOFBF, sizeof(smaps_buf));
 			if (!ps->smaps)
 				continue;
+			setvbuf(ps->smaps, smaps_buf, _IOFBF, sizeof(smaps_buf));
 		} else {
 			rewind(ps->smaps);
 		}
-- 
1.7.11.7



More information about the systemd-devel mailing list