summaryrefslogtreecommitdiff
path: root/restart.c
diff options
context:
space:
mode:
authorminkikim89 <minkikim89@gmail.com>2019-10-09 04:49:05 +0200
committerdormando <dormando@rydia.net>2019-10-22 15:52:08 -0700
commitd85ff44a56c5c796a1896c43f30d96f0d30ff163 (patch)
tree7e8b9989488e141d266ee8f05ab8dce8b831cdb5 /restart.c
parent266d582c0a05a4fbed53ebbbc6625fc5b23a7faf (diff)
downloadmemcached-d85ff44a56c5c796a1896c43f30d96f0d30ff163.tar.gz
restart: add error handling when a tag is not found in a metadata file.
Diffstat (limited to 'restart.c')
-rw-r--r--restart.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/restart.c b/restart.c
index 74faf75..1ce6799 100644
--- a/restart.c
+++ b/restart.c
@@ -82,6 +82,7 @@ static int restart_check(const char *file) {
restart_cb_ctx ctx;
ctx.f = f;
+ ctx.cb = NULL;
ctx.line = NULL;
ctx.done = false;
if (restart_get_kv(&ctx, NULL, NULL) != RESTART_DONE) {
@@ -91,6 +92,10 @@ static int restart_check(const char *file) {
// TODO: this should probably just return -1 and skip the reuse.
abort();
}
+ if (ctx.cb == NULL) {
+ fprintf(stderr, "[restart] Failed to read a tag from metadata file\n");
+ abort();
+ }
// loop call the callback, check result code.
bool failed = false;