]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
rev: be careful with close()
authorKarel Zak <kzak@redhat.com>
Thu, 13 Jun 2019 10:59:39 +0000 (12:59 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 13 Jun 2019 10:59:39 +0000 (12:59 +0200)
Addresses: https://github.com/karelzak/util-linux/issues/807
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/rev.c

index 57624e6fb117d5783b73365a035156ebc77e0a37..ae9cae5dcdda8ac21dabf3c2393eb3eb03aa13da 100644 (file)
@@ -173,7 +173,8 @@ int main(int argc, char *argv[])
                        warn("%s", filename);
                        rval = EXIT_FAILURE;
                }
-               fclose(fp);
+               if (fp != stdin)
+                       fclose(fp);
        } while(*argv);
 
        free(buf);