smemcap: keep outputting by ignoring transient processes
authorAndre Goddard Rosa <andre.rosa@lge.com>
Sun, 26 Aug 2018 15:37:30 +0000 (17:37 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 26 Aug 2018 15:37:30 +0000 (17:37 +0200)
function                                             old     new   delta
archivefile                                          167     176      +9

Signed-off-by: Andre Goddard Rosa <andre.rosa@lge.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
procps/smemcap.c

index 81f4cafad084f7eff06a90406adc14cd319efa7e..96b565f591db94fb6ced45183275758ef57da290 100644 (file)
@@ -66,6 +66,10 @@ static void archivefile(const char *path)
 
        /* buffer the file */
        fd = xopen(path, O_RDONLY);
+       if (fd == -1) {
+               /* skip vanished processes between dir listing and traversal */
+               return;
+       }
        do {
                cur = xzalloc(sizeof(*cur));
                *prev = cur;