]> diplodocus.org Git - nmh/blobdiff - uip/popsbr.c
Added context_find_prefix().
[nmh] / uip / popsbr.c
index 479fdb1f6688a4425e1634513cffcf4beea16a66..ccc76c7c40ead4ba3eb72196f1e6314889928fb6 100644 (file)
@@ -467,6 +467,7 @@ parse_proxy(char *proxy, char *host)
        } else if (!isspace(*cur))
            *c++ = *cur;
     }
+    *c = '\0';
     *++p = NULL;
     return pargv;
 }
@@ -487,8 +488,12 @@ pop_init (char *host, char *port, char *user, char *pass, char *proxy,
        int inpipe[2];    /* for reading from the server */
        int outpipe[2];    /* for sending to the server */
 
-       pipe(inpipe);
-       pipe(outpipe);
+       if (pipe(inpipe) < 0) {
+          adios ("inpipe", "pipe");
+       }
+       if (pipe(outpipe) < 0) {
+          adios ("outpipe", "pipe");
+       }
 
        pid=fork();
        if (pid==0) {
@@ -895,7 +900,7 @@ sasl_getline (char *s, int n, FILE *iop)
     *p = 0;
     if (*--p == '\n')
        *p = 0;
-    if (*--p == '\r')
+    if (p > s  &&  *--p == '\r')
        *p = 0;
 
     return OK;
@@ -932,7 +937,9 @@ putline (char *s, FILE *iop)
            return NOTOK;
        }
 
-       fwrite(buf, buflen, 1, iop);
+       if (fwrite(buf, buflen, 1, iop) < 1) {
+           advise ("putline", "fwrite");
+       }
     }
 #endif /* CYRUS_SASL */