Fix adding bulk reply when getcwd fails

This commit is contained in:
Pieter Noordhuis 2011-07-27 15:03:48 +02:00 committed by antirez
parent 33d2761bc0
commit 62e6f6c29a

View File

@ -483,12 +483,11 @@ void configGetCommand(redisClient *c) {
if (stringmatch(pattern,"dir",0)) { if (stringmatch(pattern,"dir",0)) {
char buf[1024]; char buf[1024];
addReplyBulkCString(c,"dir"); if (getcwd(buf,sizeof(buf)) == NULL)
if (getcwd(buf,sizeof(buf)) == NULL) {
buf[0] = '\0'; buf[0] = '\0';
} else {
addReplyBulkCString(c,buf); addReplyBulkCString(c,"dir");
} addReplyBulkCString(c,buf);
matches++; matches++;
} }
if (stringmatch(pattern,"dbfilename",0)) { if (stringmatch(pattern,"dbfilename",0)) {