check return value of getcwd()

This commit is contained in:
antirez 2011-02-21 17:41:25 +01:00
parent 465b4189e6
commit 09d2abdca2

View File

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