]> sourceware.org Git - lvm2.git/commitdiff
fail if status args are missing
authorAlasdair Kergon <agk@redhat.com>
Thu, 11 Jan 2007 20:11:19 +0000 (20:11 +0000)
committerAlasdair Kergon <agk@redhat.com>
Thu, 11 Jan 2007 20:11:19 +0000 (20:11 +0000)
daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
dmeventd/mirror/dmeventd_mirror.c

index 9492e3f4513aa90eb52f4342df8ff4f405df8d91..577a8cd379c9a8226fb4b1b37f4ee1add224cdc4 100644 (file)
@@ -58,7 +58,7 @@ static int _get_mirror_event(char *params)
        char *dev_status_str;
        char *log_status_str;
        char *sync_str;
-       char *p;
+       char *p = NULL;
        int log_argc, num_devs;
 
        /*
@@ -70,12 +70,13 @@ static int _get_mirror_event(char *params)
        if (!dm_split_words(params, 1, 0, &p))
                goto out_parse;
 
-       num_devs = atoi(p);
+       if (!(num_devs = atoi(p)))
+               goto out_parse;
        p += strlen(p) + 1;
 
        /* devices names + max log parameters */
        args = dm_malloc((num_devs + 8) * sizeof(char *));
-       if (!args || dm_split_words(p, num_devs + 8, 0, args) < num_devs)
+       if (!args || dm_split_words(p, num_devs + 8, 0, args) < num_devs + 8)
                goto out_parse;
 
        dev_status_str = args[2 + num_devs];
index 9492e3f4513aa90eb52f4342df8ff4f405df8d91..577a8cd379c9a8226fb4b1b37f4ee1add224cdc4 100644 (file)
@@ -58,7 +58,7 @@ static int _get_mirror_event(char *params)
        char *dev_status_str;
        char *log_status_str;
        char *sync_str;
-       char *p;
+       char *p = NULL;
        int log_argc, num_devs;
 
        /*
@@ -70,12 +70,13 @@ static int _get_mirror_event(char *params)
        if (!dm_split_words(params, 1, 0, &p))
                goto out_parse;
 
-       num_devs = atoi(p);
+       if (!(num_devs = atoi(p)))
+               goto out_parse;
        p += strlen(p) + 1;
 
        /* devices names + max log parameters */
        args = dm_malloc((num_devs + 8) * sizeof(char *));
-       if (!args || dm_split_words(p, num_devs + 8, 0, args) < num_devs)
+       if (!args || dm_split_words(p, num_devs + 8, 0, args) < num_devs + 8)
                goto out_parse;
 
        dev_status_str = args[2 + num_devs];
This page took 0.03833 seconds and 5 git commands to generate.