Fix command line parsing bug
authorJens Axboe <jens.axboe@oracle.com>
Thu, 19 Apr 2007 07:53:28 +0000 (09:53 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 19 Apr 2007 07:53:28 +0000 (09:53 +0200)
The first parameters are for the global job, if no --name section
has been seen yet. We don't require a --name=global section to appear
first.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
init.c

diff --git a/init.c b/init.c
index da2595c7aa29f905b89b41a34a52b8ce0918cd0c..b62c3972af568ddffebbb1af77bcfb38115b6ca0 100644 (file)
--- a/init.c
+++ b/init.c
@@ -790,7 +790,11 @@ static int parse_cmd_line(int argc, char *argv[])
                                td = NULL;
                        }
                        if (!td) {
-                               int global = !strncmp(val, "global", 6);
+                               int global = 0;
+
+                               if (strncmp(opt, "name", 4) ||
+                                   !strncmp(val, "global", 6))
+                                       global = 1;
 
                                td = get_new_job(global, &def_thread);
                                if (!td)