[BusyBox] Mkfifo fix

Pavel Roskin pavel_roskin at geocities.com
Fri Jun 2 19:33:15 UTC 2000


Hello!

Imagine this situation: you run "mkfifo --help" and it happily creates
"--help". Then you run "rm --help" anf guess what it does? It explains you
how to use "rm" :-)

Since we don't want getopt (but we probably want a light-weight 
replacement in the future), we shouldn't let "mkfifo" create "--help"

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

Regards,
Pavel Roskin

===================================
diff -u -r1.4 mkfifo.c
--- mkfifo.c	2000/05/12 19:41:47	1.4
+++ mkfifo.c	2000/06/02 19:24:28
@@ -60,7 +60,7 @@
 		argc--;
 		argv++;
 	}
-	if (argc < 1)
+	if (argc < 1 || *argv[0] == '-')
 		usage(mkfifo_usage);
 	if (mkfifo(*argv, mode) < 0) {
 		perror("mkfifo");
===================================






More information about the busybox mailing list