From 7d1e15808422a1233280440566a5c684de7aa92f Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 3 Feb 2015 10:25:01 +0100 Subject: 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. --- src/redis-check-rdb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/redis-check-rdb.c') diff --git a/src/redis-check-rdb.c b/src/redis-check-rdb.c index ff87f142f..21f72c222 100644 --- a/src/redis-check-rdb.c +++ b/src/redis-check-rdb.c @@ -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 \n", argv[0]); + exit(1); + } + redisLog(REDIS_WARNING, "Checking RDB file %s", argv[1]); + exit(redis_check_rdb(argv[1])); + return 0; +} -- cgit v1.2.1