diff options
author | Jia Zhouyang <jiazhouyang@nudt.edu.cn> | 2018-03-04 12:42:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-04 12:42:40 +0000 |
commit | e0d419f0349b5eb17086e511bacf57b604e96f9f (patch) | |
tree | 25b73b63685a9de2495b15f9cb052e06573b89fa | |
parent | Update ChangeLog (diff) | |
download | w3m-e0d419f0349b5eb17086e511bacf57b604e96f9f.tar.gz w3m-e0d419f0349b5eb17086e511bacf57b604e96f9f.zip |
Add error handling for chdir
When chdir fails, print error message and exit.
Diffstat (limited to '')
-rw-r--r-- | local.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -426,7 +426,10 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) } #ifdef HAVE_CHDIR /* ifndef __EMX__ ? */ - chdir(cgi_dir); + if (chdir(cgi_dir) == -1) { + fprintf(stderr, "failed to chdir to %s: %s\n", cgi_dir, strerror(errno)); + exit(1); + } #endif execl(file, cgi_basename, NULL); fprintf(stderr, "execl(\"%s\", \"%s\", NULL): %s\n", |