From 58f263cb1cc09f9036ec9ddd5908cba56885796f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 31 Oct 2011 11:22:32 +0100 Subject: [PATCH] exit if state file cannot be written --- index/zebraapi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 1.7.10.4