Don't allow mkfifo to create files such as "--help"
authorEric Andersen <andersen@codepoet.org>
Sun, 4 Jun 2000 05:17:35 +0000 (05:17 -0000)
committerEric Andersen <andersen@codepoet.org>
Sun, 4 Jun 2000 05:17:35 +0000 (05:17 -0000)
This patch checks if the name of FIFO to be created begins with "-" and
calls usage() if it does.

Regards,
Pavel Roskin

coreutils/mkfifo.c
mkfifo.c

index ef3d667e2a981a52ab495f9f96849a884ff978e8..46b1343cd33c2f46c58825e9b3caad75b9a4bce8 100644 (file)
@@ -60,7 +60,7 @@ extern int mkfifo_main(int argc, char **argv)
                argc--;
                argv++;
        }
-       if (argc < 1)
+       if (argc < 1 || *argv[0] == '-')
                usage(mkfifo_usage);
        if (mkfifo(*argv, mode) < 0) {
                perror("mkfifo");
index ef3d667e2a981a52ab495f9f96849a884ff978e8..46b1343cd33c2f46c58825e9b3caad75b9a4bce8 100644 (file)
--- a/mkfifo.c
+++ b/mkfifo.c
@@ -60,7 +60,7 @@ extern int mkfifo_main(int argc, char **argv)
                argc--;
                argv++;
        }
-       if (argc < 1)
+       if (argc < 1 || *argv[0] == '-')
                usage(mkfifo_usage);
        if (mkfifo(*argv, mode) < 0) {
                perror("mkfifo");