提交 eb5aeaf1 编写于 作者: A antirez

check return value of getcwd()

上级 1a6281f5
......@@ -471,10 +471,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)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册