summaryrefslogtreecommitdiff
path: root/src/redis-check-rdb.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-02-03 10:25:01 +0100
committerantirez <antirez@gmail.com>2015-02-03 10:25:01 +0100
commit7d1e15808422a1233280440566a5c684de7aa92f (patch)
tree4cdfb13947f83d893d35404f961471bcfdad1316 /src/redis-check-rdb.c
parent45102a6f639712cd6025112bac6a988dc6e6b897 (diff)
downloadredis-7d1e15808422a1233280440566a5c684de7aa92f.tar.gz
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.
Diffstat (limited to 'src/redis-check-rdb.c')
-rw-r--r--src/redis-check-rdb.c12
1 files changed, 12 insertions, 0 deletions
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 <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;
+}