X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/70cb03e172a892e75542d895932b320ee7bf5167..046f70f758a263052a044f78e808a5ebf2bc24ca:/src/redis.c diff --git a/src/redis.c b/src/redis.c index 658d2486..6f52ada2 100644 --- a/src/redis.c +++ b/src/redis.c @@ -209,6 +209,7 @@ struct redisCommand redisCommandTable[] = { {"cluster",clusterCommand,-2,"ar",0,NULL,0,0,0,0,0}, {"restore",restoreCommand,4,"awm",0,NULL,1,1,1,0,0}, {"migrate",migrateCommand,6,"aw",0,NULL,0,0,0,0,0}, + {"asking",askingCommand,1,"r",0,NULL,0,0,0,0,0}, {"dump",dumpCommand,2,"ar",0,NULL,0,0,0,0,0}, {"object",objectCommand,-2,"r",0,NULL,0,0,0,0,0}, {"client",clientCommand,-2,"ar",0,NULL,0,0,0,0,0}, @@ -1249,7 +1250,9 @@ int prepareForShutdown() { /*================================== Commands =============================== */ void authCommand(redisClient *c) { - if (!server.requirepass || !strcmp(c->argv[1]->ptr, server.requirepass)) { + if (!server.requirepass) { + addReplyError(c,"Client sent AUTH, but no password is set"); + } else if (!strcmp(c->argv[1]->ptr, server.requirepass)) { c->authenticated = 1; addReply(c,shared.ok); } else { @@ -1800,8 +1803,13 @@ int main(int argc, char **argv) { if (loadAppendOnlyFile(server.appendfilename) == REDIS_OK) redisLog(REDIS_NOTICE,"DB loaded from append only file: %.3f seconds",(float)(ustime()-start)/1000000); } else { - if (rdbLoad(server.dbfilename) == REDIS_OK) - redisLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds",(float)(ustime()-start)/1000000); + if (rdbLoad(server.dbfilename) == REDIS_OK) { + redisLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds", + (float)(ustime()-start)/1000000); + } else if (errno != ENOENT) { + redisLog(REDIS_WARNING,"Fatal error loading the DB. Exiting."); + exit(1); + } } if (server.ipfd > 0) redisLog(REDIS_NOTICE,"The server is now ready to accept connections on port %d", server.port);