X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/4c436246f048635446353dadaa68174445c58160..0860f098b5a13f4e8bedb2d2da9d2df94717b4a5:/uip/mhcachesbr.c diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index 7e684e1f..7814d6ee 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -279,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; @@ -333,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); @@ -366,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 (;;) {