]> diplodocus.org Git - nmh/blobdiff - uip/slocal.c
Dynamically allocate space for the output of fmt_scan(), using
[nmh] / uip / slocal.c
index fb21c88015faed6b40ea8f58cef52c1ba9004104..8afef253c815a8204b8b64e87e5ee3cf6daabf92 100644 (file)
@@ -183,7 +183,7 @@ int
 main (int argc, char **argv)
 {
     int fd, status;
-    FILE *fp = stdin;
+    FILE *fp;
     char *cp, *mdlvr = NULL, buf[BUFSIZ];
     char mailbox[BUFSIZ], tmpfil[BUFSIZ];
     char **argp, **arguments;
@@ -1414,6 +1414,7 @@ suppress_duplicates (int fd, char *file)
     rewind (in);
 
     for (;;) {
+        int failed_to_lock = 0;
        int bufsz = sizeof buf;
        state = m_getfld (&gstate, name, buf, &bufsz, in);
        switch (state) {
@@ -1451,7 +1452,8 @@ suppress_duplicates (int fd, char *file)
                 * This will fail if your Maildelivery file doesn't
                 * exist.
                 */
-               if ((lockfd = lkopendata(file, O_RDWR, 0)) == -1) {
+               if ((lockfd = lkopendata(file, O_RDWR, 0, &failed_to_lock))
+                   == -1) {
                    advise (file, "unable to perform file locking on");
                    free (cp);
                    fclose (in);