From: Adam Dickmeiss Date: Mon, 31 Oct 2011 10:22:32 +0000 (+0100) Subject: exit if state file cannot be written X-Git-Tag: v2.0.50~7 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=58f263cb1cc09f9036ec9ddd5908cba56885796f;p=idzebra-moved-to-github.git exit if state file cannot be written --- diff --git a/index/zebraapi.c b/index/zebraapi.c index b696907..1c30eaa 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1627,7 +1627,11 @@ static void zebra_set_state(ZebraHandle zh, int val, int seqno) sprintf(state_fname, "state.%s.LCK", zh->reg_name); fname = zebra_mk_fname(res_get(zh->res, "lockDir"), state_fname); f = fopen(fname, "w"); - + if (!f) + { + yaz_log(YLOG_FATAL|YLOG_ERRNO, "open %s w", state_fname); + exit(1); + } yaz_log(YLOG_DEBUG, "zebra_set_state: %c %d %ld", val, seqno, p); fprintf(f, "%c %d %ld\n", val, seqno, p); fclose(f);