Fix unchecked chdir() return value

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2010-06-12 18:05:17 +02:00
parent 3389c3b797
commit 2fefc8d563

View File

@@ -576,8 +576,9 @@ static void run_pager(struct grep_opt *opt, const char *prefix)
argv[i] = path_list->items[i].string;
argv[path_list->nr] = NULL;
if (prefix)
chdir(prefix);
if (prefix && chdir(prefix))
die("Could not chdir(%s)", prefix);
execvp(argv[0], argv);
error("Could not run pager %s: %s", argv[0], strerror(errno));
}