diff options
-rw-r--r-- | auto.def | 12 | ||||
-rw-r--r-- | jim-interactive.c | 6 | ||||
-rw-r--r-- | jim-win32compat.h | 8 | ||||
-rwxr-xr-x | make-bootstrap-jim | 9 |
4 files changed, 25 insertions, 10 deletions
@@ -104,7 +104,7 @@ cc-check-functions ualarm lstat fork vfork system select execvpe cc-check-functions backtrace geteuid mkstemp realpath strptime isatty cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist isascii cc-check-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes -cc-check-functions shutdown socketpair isinf isnan link symlink fsync dup +cc-check-functions shutdown socketpair isinf isnan link symlink fsync dup umask if {[cc-check-functions sysinfo]} { cc-with {-includes sys/sysinfo.h} { @@ -166,6 +166,14 @@ if {[cctest -includes {sys/types.h sys/stat.h} -code {mkdir("/dummy");}]} { msg-result no } +cc-with {-includes sys/stat.h} { + foreach i {S_IXUSR S_IRWXG S_IRWXO} { + if {![cc-check-decls $i]} { + define $i 0 + } + } +} + set extra_objs {} set jimregexp 0 @@ -409,7 +417,7 @@ define EXTRA_OBJS $extra_objs define LIBS $LIBS make-config-header jim-config.h -auto {HAVE_LONG_LONG* JIM_UTF8} -bare JIM_VERSION -none * -make-config-header jimautoconf.h -auto {jim_ext_* TCL_PLATFORM_* TCL_LIBRARY USE_* JIM_* _FILE_OFFSET*} +make-config-header jimautoconf.h -auto {jim_ext_* TCL_PLATFORM_* TCL_LIBRARY USE_* JIM_* _FILE_OFFSET*} -bare {S_I*} make-template Makefile.in make-template build-jim-ext.in diff --git a/jim-interactive.c b/jim-interactive.c index 932e8e1..d263e83 100644 --- a/jim-interactive.c +++ b/jim-interactive.c @@ -7,6 +7,8 @@ #ifdef USE_LINENOISE #ifdef HAVE_UNISTD_H #include <unistd.h> +#endif +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif #include "linenoise.h" @@ -57,12 +59,16 @@ void Jim_HistoryAdd(const char *line) void Jim_HistorySave(const char *filename) { #ifdef USE_LINENOISE +#ifdef HAVE_UMASK mode_t mask; /* Just u=rw, but note that this is only effective for newly created files */ mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); +#endif linenoiseHistorySave(filename); +#ifdef HAVE_UMASK mask = umask(mask); #endif +#endif } void Jim_HistoryShow(void) diff --git a/jim-win32compat.h b/jim-win32compat.h index 9cd35a3..325d1dd 100644 --- a/jim-win32compat.h +++ b/jim-win32compat.h @@ -21,14 +21,6 @@ char *dlerror(void); #define JIM_SPRINTF_DOUBLE_NEEDS_FIX #endif -/* MinGW does not have group/owner permissions */ -#ifndef S_IRWXG -#define S_IRWXG 0 -#endif -#ifndef S_IRWXO -#define S_IRWXO 0 -#endif - #ifdef _MSC_VER /* These are msvc vs gcc */ diff --git a/make-bootstrap-jim b/make-bootstrap-jim index c1754f7..23f852a 100755 --- a/make-bootstrap-jim +++ b/make-bootstrap-jim @@ -74,6 +74,14 @@ cat <<EOF #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H +#define HAVE_UMASK +#include <sys/stat.h> +#ifndef S_IRWXG +#define S_IRWXG 0 +#endif +#ifndef S_IRWXO +#define S_IRWXO 0 +#endif #else #define TCL_PLATFORM_OS "unknown" #define TCL_PLATFORM_PLATFORM "unix" @@ -92,6 +100,7 @@ cat <<EOF #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H +#define HAVE_UMASK #endif EOF |