From 18dcbadf2771cdb0c18509b14e4e73505b242753 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Sun, 21 Jan 2018 01:29:10 +0900 Subject: Make temporary directory safely when ~/.w3m is unwritable --- main.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index a20b4a1..43e181c 100644 --- a/main.c +++ b/main.c @@ -5971,6 +5971,13 @@ w3m_exit(int i) #endif #ifdef __MINGW32_VERSION WSACleanup(); +#endif +#ifdef HAVE_MKDTEMP + if (no_rc_dir && tmp_dir != rc_dir) + if (rmdir(tmp_dir) != 0) { + fprintf(stderr, "Can't remove temporary directory (%s)!\n", tmp_dir); + exit(1); + } #endif exit(i); } -- cgit v1.2.3