diff --git a/configure.in b/configure.in index 8ed50a5032..8d0d9a5485 100644 --- a/configure.in +++ b/configure.in @@ -606,6 +606,7 @@ AC_CHECK_FUNCS(pthread_keycreate pthread_key_create) AC_CHECK_FUNCS(llrint) AC_CHECK_FUNCS(localtime_r) AC_CHECK_FUNCS(gmtime_r) +AC_CHECK_FUNCS(fchmod) if test "$ac_cv_header_semaphore_h" = "yes"; then savedFlags="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" diff --git a/src/jrd/os/posix/unix.cpp b/src/jrd/os/posix/unix.cpp index f2f232c0b6..e96a5c9723 100644 --- a/src/jrd/os/posix/unix.cpp +++ b/src/jrd/os/posix/unix.cpp @@ -108,7 +108,7 @@ using namespace Jrd; #ifdef SUPERSERVER #define MASK 0600 #else -#define MASK 0666 +#define MASK 0660 #endif #define FCNTL_BROKEN @@ -219,7 +219,7 @@ jrd_file* PIO_create(Database* dbb, const Firebird::PathName& file_name, #endif #endif - const int desc = open(file_name.c_str(), flag, MASK); + const int desc = open(file_name.c_str(), flag, 0666); if (desc == -1) { ERR_post(isc_io_error, @@ -227,6 +227,17 @@ jrd_file* PIO_create(Database* dbb, const Firebird::PathName& file_name, isc_arg_string, ERR_string(file_name), isc_arg_gds, isc_io_create_err, isc_arg_unix, errno, 0); } +#ifdef HAVE_FCHMOD + if (fchmod(desc, MASK) < 0) +#else + if (chmod(file_name.c_str(), MASK) < 0) +#endif + { + ERR_post(isc_io_error, + isc_arg_string, "chmod", + isc_arg_string, ERR_string(file_name), + isc_arg_gds, isc_io_create_err, isc_arg_unix, errno, 0); + } if (temporary #ifdef SUPPORT_RAW_DEVICES