aboutsummaryrefslogtreecommitdiffstats
path: root/local.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2018-03-04 14:54:59 +0000
committerGitHub <noreply@github.com>2018-03-04 14:54:59 +0000
commit4f2be7d71edba728917523ad1c5f9f5b90529106 (patch)
treeb0201f1c383c856f6ac538b6e4d384e172fbcb92 /local.c
parentUpdate ChangeLog (diff)
parentAdd error handling code for fopen (diff)
downloadw3m-4f2be7d71edba728917523ad1c5f9f5b90529106.tar.gz
w3m-4f2be7d71edba728917523ad1c5f9f5b90529106.zip
Merge pull request #96 from ZhouyangJia/master
Fix crashes when some external APIs fail
Diffstat (limited to '')
-rw-r--r--local.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/local.c b/local.c
index 46ac579..56d589d 100644
--- a/local.c
+++ b/local.c
@@ -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",