From 3dc145bde2500acd080b9d1c3ba4e7e5170cf40d Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 18 May 2006 21:46:42 +0200 Subject: [PATCH] Changes related to Win32 port. S_IRWXG and S_IRWXO were undefined under crossmingw32. init_static_version must be called after init_options because ELinks wanted to read "verbose" option before it was initialized. --- src/main/main.c | 5 ++--- src/network/connection.h | 1 + src/util/file.c | 6 ++++-- src/util/secsave.c | 5 +++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/main.c b/src/main/main.c index e85c72ccd..173e09331 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -111,7 +111,6 @@ init(void) enum retval ret; init_osdep(); - init_static_version(); check_cwd(); #ifdef CONFIG_NLS @@ -119,14 +118,14 @@ init(void) textdomain(PACKAGE); set_language(0); #endif - init_event(); - init_charsets_lookup(); init_colors_lookup(); init_modules(main_modules); init_options(); + init_static_version(); + register_modules_options(main_modules); register_modules_options(builtin_modules); set_sigcld(); diff --git a/src/network/connection.h b/src/network/connection.h index 2c1b9ac47..67ce5d2e6 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -6,6 +6,7 @@ #include "main/timer.h" /* timer_id_T */ #include "network/state.h" #include "util/lists.h" +#include struct download; struct socket; diff --git a/src/util/file.c b/src/util/file.c index feaadc2ad..8ed2cea0b 100644 --- a/src/util/file.c +++ b/src/util/file.c @@ -272,11 +272,13 @@ file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno) int safe_mkstemp(unsigned char *template) { +#ifndef CONFIG_OS_WIN32 mode_t saved_mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); +#endif int fd = mkstemp(template); - +#ifndef CONFIG_OS_WIN32 umask(saved_mask); - +#endif return fd; } diff --git a/src/util/secsave.c b/src/util/secsave.c index 3b3a306ed..23ea093ac 100644 --- a/src/util/secsave.c +++ b/src/util/secsave.c @@ -206,7 +206,12 @@ end: struct secure_save_info * secure_open(unsigned char *file_name) { +#ifdef CONFIG_OS_WIN32 + /* There is neither S_IRWXG nor S_IRWXO under crossmingw32-gcc */ + return secure_open_umask(file_name, 0177); +#else return secure_open_umask(file_name, S_IXUSR | S_IRWXG | S_IRWXO); +#endif } /* Close a file opened with secure_open, and return 0 on success, errno