Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

check return value of getcwd()

  • Loading branch information...
commit eb5aeaf138b4977a06afefc684801c6cf1da118a 1 parent 1a6281f
@antirez antirez authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/config.c
View
8 src/config.c
@@ -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)) {
Please sign in to comment.
Something went wrong with that request. Please try again.