]> diplodocus.org Git - nmh/blobdiff - uip/mhcachesbr.c
mhshow: suppress error for undisplayable parts, if they're not wanted
[nmh] / uip / mhcachesbr.c
index 136b567807e6c9b84506b8dda4ba3982d57aa238..7814d6ee692126dc9dccc051568a84d68596a081 100644 (file)
@@ -25,8 +25,6 @@
 
 extern int debugsw;
 
-extern pid_t xpid;     /* mhshowsbr.c or mhbuildsbr.c */
-
 /* cache policies */
 int rcachesw = CACHE_ASK;
 int wcachesw = CACHE_ASK;
@@ -226,13 +224,6 @@ got_it:
        int len, buflen;
        char *bp, query[BUFSIZ];
 
-       if (xpid) {
-           if (xpid < 0)
-               xpid = -xpid;
-           pidcheck (pidwait (xpid, NOTOK));
-           xpid = 0;
-       }
-
        /* Get buffer ready to go */
        bp = query;
        buflen = sizeof(query);
@@ -288,6 +279,7 @@ find_cache_aux (int writing, char *directory, char *id,
     int        mask, usemap;
     char mapfile[BUFSIZ], mapname[BUFSIZ];
     FILE *fp;
+    int failed_to_lock = 0;
     static int partno, pid;
     static time_t clock = 0;
 
@@ -342,12 +334,15 @@ use_raw:
 
     make_intermediates (mapfile);
     mask = umask (writing == 2 ? 0077 : 0);
-    if (!(fp = lkfopendata (mapfile, "a")) && errno == ENOENT) {
+    if (!(fp = lkfopendata (mapfile, "a", &failed_to_lock)) && errno == ENOENT) {
        int fd;
 
        if ((fd = creat (mapfile, 0666)) != NOTOK) {
            close (fd);
-           fp = lkfopendata (mapfile, "a");
+           fp = lkfopendata (mapfile, "a", &failed_to_lock);
+            if (failed_to_lock) {
+               adios (mapfile, "failed to lock");
+            }
        }
     }
     umask (mask);
@@ -375,8 +370,9 @@ find_cache_aux2 (char *mapfile, char *id, char *mapname, int namelen)
     char buf[BUFSIZ], name[NAMESZ];
     FILE *fp;
     m_getfld_state_t gstate = 0;
+    int failed_to_lock = 0;
 
-    if (!(fp = lkfopendata (mapfile, "r")))
+    if (!(fp = lkfopendata (mapfile, "r", &failed_to_lock)))
        return NOTOK;
 
     for (;;) {