chiark / gitweb /
bootchart: check return of fopen before setvbuf in log.c
authorLukas Nykryn <lnykryn@redhat.com>
Wed, 9 Jan 2013 16:10:57 +0000 (17:10 +0100)
committerKay Sievers <kay@vrfy.org>
Wed, 9 Jan 2013 16:15:19 +0000 (17:15 +0100)
src/bootchart/log.c

index 89c7b35..6c40913 100644 (file)
@@ -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);
                }