[PATCH 2/4] automount: fix argument parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With getopt we have to use argv[optind] instead of hardcoded argv[0]

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 commands/automount.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/automount.c b/commands/automount.c
index 5fc68f3..8c0e4de 100644
--- a/commands/automount.c
+++ b/commands/automount.c
@@ -40,10 +40,10 @@ static int do_automount(int argc, char *argv[])
 		}
 	}
 
-	if (argc != 3)
+	if (optind + 2 != argc)
 		return COMMAND_ERROR_USAGE;
 
-	ret = automount_add(argv[1], argv[2]);
+	ret = automount_add(argv[optind], argv[optind + 1]);
 	if (ret)
 		printf("adding automountpoint failed: %s\n",
 				strerror(-ret));
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux