File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ static int restart_check(const char *file) {
82
82
restart_cb_ctx ctx ;
83
83
84
84
ctx .f = f ;
85
+ ctx .cb = NULL ;
85
86
ctx .line = NULL ;
86
87
ctx .done = false;
87
88
if (restart_get_kv (& ctx , NULL , NULL ) != RESTART_DONE ) {
@@ -91,6 +92,10 @@ static int restart_check(const char *file) {
91
92
// TODO: this should probably just return -1 and skip the reuse.
92
93
abort ();
93
94
}
95
+ if (ctx .cb == NULL ) {
96
+ fprintf (stderr , "[restart] Failed to read a tag from metadata file\n" );
97
+ abort ();
98
+ }
94
99
95
100
// loop call the callback, check result code.
96
101
bool failed = false;
Original file line number Diff line number Diff line change @@ -12,6 +12,15 @@ use MemcachedTest;
12
12
# /dev/shm.
13
13
my $mem_path = " /tmp/mc_restart.$$ " ;
14
14
15
+ # read a invalid metadata file
16
+ {
17
+ my $meta_path = " $mem_path .meta" ;
18
+ open (my $f , " > $meta_path " ) || die (" Can't open a metadata file." );
19
+ eval { new_memcached(" -e $mem_path " ); };
20
+ unlink ($meta_path );
21
+ ok($@ , " Died with an empty metadata file" );
22
+ }
23
+
15
24
my $server = new_memcached(" -m 128 -e $mem_path -I 2m" );
16
25
my $sock = $server -> sock;
17
26
You can’t perform that action at this time.
0 commit comments