X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/8cebca1119664be52f1cbccd0ee052ae0b8c1de0..c9794733:/uip/mhcachesbr.c?ds=sidebyside diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index 136b5678..7814d6ee 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -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 (;;) {