Fix condition for unix socket option parsing
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 23 Oct 2012 11:27:01 +0000 (13:27 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 23 Oct 2012 11:35:16 +0000 (13:35 +0200)
Search for = instead of , in options, so that the case of
unix:file=/myfile works. The search for = will make this case work.
Previously a comma had to be included in the spec.

src/unix.c

index 60cbedc..f2b26d6 100644 (file)
@@ -197,12 +197,12 @@ static void *unix_straddr1(COMSTACK h, const char *str, char *f)
     unix_state *sp = (unix_state *)h->cprivate;
     char * s = f;
     const char * file = NULL;
     unix_state *sp = (unix_state *)h->cprivate;
     char * s = f;
     const char * file = NULL;
-    char * eol;
 
     sp->uid = sp->gid = sp->umask = -1;
 
 
     sp->uid = sp->gid = sp->umask = -1;
 
-    if ((eol = strchr(s, ',')))
+    if (strchr(s, '='))
     {
     {
+        char *eol;
         do
         {
             if ((eol = strchr(s, ',')))
         do
         {
             if ((eol = strchr(s, ',')))
@@ -569,8 +569,8 @@ static int unix_get(COMSTACK h, char **buf, int *bufsize)
     TRC(fprintf(stderr, "unix_get: bufsize=%d\n", *bufsize));
     if (sp->altlen) /* switch buffers */
     {
     TRC(fprintf(stderr, "unix_get: bufsize=%d\n", *bufsize));
     if (sp->altlen) /* switch buffers */
     {
-        TRC(fprintf(stderr, "  %d bytes in altbuf (0x%x)\n", sp->altlen,
-                    (unsigned) sp->altbuf));
+        TRC(fprintf(stderr, "  %d bytes in altbuf (%p )\n", sp->altlen,
+                    sp->altbuf));
         tmpc = *buf;
         tmpi = *bufsize;
         *buf = sp->altbuf;
         tmpc = *buf;
         tmpi = *bufsize;
         *buf = sp->altbuf;
@@ -632,8 +632,8 @@ static int unix_get(COMSTACK h, char **buf, int *bufsize)
         } else if (sp->altsize < req)
             if (!(sp->altbuf =(char *)xrealloc(sp->altbuf, sp->altsize = req)))
                 return -1;
         } else if (sp->altsize < req)
             if (!(sp->altbuf =(char *)xrealloc(sp->altbuf, sp->altsize = req)))
                 return -1;
-        TRC(fprintf(stderr, "  Moving %d bytes to altbuf(0x%x)\n", tomove,
-                    (unsigned) sp->altbuf));
+        TRC(fprintf(stderr, "  Moving %d bytes to altbuf(%p)\n", tomove,
+                    sp->altbuf));
         memcpy(sp->altbuf, *buf + berlen, sp->altlen = tomove);
     }
     if (berlen < CS_UNIX_BUFCHUNK - 1)
         memcpy(sp->altbuf, *buf + berlen, sp->altlen = tomove);
     }
     if (berlen < CS_UNIX_BUFCHUNK - 1)