Handle redis-check-rdb as a standalone program.

This also makes it backward compatible in the usage, but for the command
name. However the old command name was less obvious so it is worth to
break it probably.

With the new setup the program main can perform argument parsing and
everything else useful for an RDB check regardless of the Redis server
itself.
This commit is contained in:
antirez
2015-02-03 10:25:01 +01:00
parent 45102a6f63
commit 7d1e158084
4 changed files with 20 additions and 18 deletions

View File

@ -696,3 +696,15 @@ int redis_check_rdb(char *rdbfilename) {
close(fd);
return 0;
}
/* RDB check main: called form redis.c when Redis is executed with the
* redis-check-rdb alias. */
int redis_check_rdb_main(char **argv, int argc) {
if (argc != 2) {
fprintf(stderr, "Usage: %s <rdb-file-name>\n", argv[0]);
exit(1);
}
redisLog(REDIS_WARNING, "Checking RDB file %s", argv[1]);
exit(redis_check_rdb(argv[1]));
return 0;
}