]> git.marmaro.de Git - mmh/commitdiff
new: Fix a pointer problem
authormarkus schnalke <meillo@marmaro.de>
Thu, 15 Jan 2015 20:40:53 +0000 (21:40 +0100)
committermarkus schnalke <meillo@marmaro.de>
Thu, 15 Jan 2015 20:43:15 +0000 (21:43 +0100)
I should learn to get such stuff right without the need to draw
the memory layout with boxes and lines on paper ...

Thanks to the test suite for catching this one!

uip/new.c

index a43a710fe6fc392d7ef6a6158add3356f96435a2..1ee95ffd46dbff9b9a3384e1c1c8881a7cc1c49f 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -314,7 +314,7 @@ doit(char *cur, char *folders, char *sequences[])
        char *sequences_s = NULL;
        int argc = 0;
        char *argv[MAXARGS];
-       char *cp;
+       char **seqp;
        char buf[BUFSIZ];
 
        if (cur == NULL || cur[0] == '\0') {
@@ -391,8 +391,8 @@ doit(char *cur, char *folders, char *sequences[])
                        argv[argc++] = "scan";
                        snprintf(buf, sizeof buf, "+%s", node->n_name);
                        argv[argc++] = buf;
-                       for (cp=*sequences; *cp; cp++) {
-                               argv[argc++] = cp;
+                       for (seqp=sequences; *seqp; seqp++) {
+                               argv[argc++] = *seqp;
                        }
                        argv[argc] = (char *)NULL;
                        execprog(*argv, argv);