Don't allow mkfifo to create files such as "--help"

This patch checks if the name of FIFO to be created begins with "-" and
calls usage() if it does.

Regards,
Pavel Roskin
This commit is contained in:
Eric Andersen 2000-06-04 05:17:35 +00:00
parent ef4268efa7
commit 46a38dbb9b
2 changed files with 2 additions and 2 deletions

View 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");

View 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");