提交 09d2abdc 编写于 作者: A antirez

check return value of getcwd()

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