lynx/lynx-1-2.8.6-tmp_dir.patch

35 lines
894 B
Diff

--- lynx2-8-6/src/LYMain.c 2008-07-07 03:01:11.000000000 +0200
+++ lynx2-8-6/src/LYMain.c.pix 2008-07-07 03:01:51.000000000 +0200
@@ -969,7 +969,7 @@
struct stat dir_info;
char filename[LY_MAXPATH];
BOOL LYGetStdinArgs = FALSE;
-
+ struct stat st;
#ifdef _WINDOWS
WSADATA WSAData;
#endif /* _WINDOWS */
@@ -1206,7 +1206,22 @@
if (access(lynx_temp_space, 0) != 0)
#endif
tildeExpand(&lynx_temp_space, TRUE);
+
+
+ if (stat(lynx_temp_space, &st) < 0) {
+ if (errno = ENOENT) {
+ printf("Creating dir %s\n", lynx_temp_space);
+ mkdir(lynx_temp_space, 0700);
+ }
+ }
+ if (stat(lynx_temp_space, &st) < 0) {
+ if (errno = ENOENT) {
+ printf("Can't create %s, let's try /tmp/\n", lynx_temp_space);
+ lynx_temp_space = "/tmp/";
+ }
+ }
+
if ((cp = strstr(lynx_temp_space, "$USER")) != NULL) {
char *cp1;