aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--monitor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index 5ea35de849..1be222ee18 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4207,9 +4207,9 @@ static void file_completion(const char *input)
/* stat the file to find out if it's a directory.
* In that case add a slash to speed up typing long paths
*/
- stat(file, &sb);
- if(S_ISDIR(sb.st_mode))
+ if (stat(file, &sb) == 0 && S_ISDIR(sb.st_mode)) {
pstrcat(file, sizeof(file), "/");
+ }
readline_add_completion(cur_mon->rs, file);
}
}