X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbootchart%2Fstore.c;fp=src%2Fbootchart%2Fstore.c;h=8e9a62f91d9f9402cdcf14cab0190982f852833d;hb=58ec01b35c046f5f167763343514c20170bfd2eb;hp=3900936acfc21da4a5338c8660d495f06f6f3f2e;hpb=9964a9eb7b18d6ad172a7921cf88efabde05d121;p=elogind.git diff --git a/src/bootchart/store.c b/src/bootchart/store.c index 3900936ac..8e9a62f91 100644 --- a/src/bootchart/store.c +++ b/src/bootchart/store.c @@ -330,9 +330,13 @@ schedstat_next: /* ppid */ sprintf(filename, "%d/stat", pid); fd = openat(procfd, filename, O_RDONLY); + if (fd == -1) + continue; st = fdopen(fd, "r"); - if (!st) + if (!st) { + close(fd); continue; + } if (!fscanf(st, "%*s %*s %*s %i", &p)) { continue; } @@ -432,9 +436,13 @@ schedstat_next: if (!ps->smaps) { sprintf(filename, "%d/smaps", pid); fd = openat(procfd, filename, O_RDONLY); + if (fd == -1) + continue; ps->smaps = fdopen(fd, "r"); - if (!ps->smaps) + if (!ps->smaps) { + close(fd); continue; + } setvbuf(ps->smaps, smaps_buf, _IOFBF, sizeof(smaps_buf)); } else {