Only in firebird: Makefile Only in firebird: build.log diff -ur firebird.org/builds/posix/Makefile.in.client.gfix firebird/builds/posix/Makefile.in.client.gfix --- firebird.org/builds/posix/Makefile.in.client.gfix 2014-07-03 13:40:07.000000000 +0200 +++ firebird/builds/posix/Makefile.in.client.gfix 2014-07-03 13:45:17.000000000 +0200 @@ -39,7 +39,8 @@ @SET_MAKE@ -GFIX_Other_Sources = jrd/isc.cpp jrd/ThreadData.cpp jrd/path_utils.cpp common/UtilSvc.cpp +GFIX_Other_Sources = jrd/isc.cpp jrd/ThreadData.cpp jrd/path_utils.cpp common/UtilSvc.cpp \ + $(OS_SPECIFIC_Sources) GFIX_Files = alice_meta.epp alice.cpp exe.cpp tdr.cpp aliceMain.cpp GFIX_Sources = $(addprefix alice/, $(GFIX_Files)) $(GFIX_Other_Sources) diff -ur firebird.org/builds/posix/Makefile.in.client.util firebird/builds/posix/Makefile.in.client.util --- firebird.org/builds/posix/Makefile.in.client.util 2014-07-03 13:40:07.000000000 +0200 +++ firebird/builds/posix/Makefile.in.client.util 2014-07-03 13:45:17.000000000 +0200 @@ -90,7 +90,7 @@ $(FBCLASSES_MsgObjects) $(CLUMPLETS_Objects) $(FBCOMMON_ClientObjects) -FBGUARD_Other_Sources = jrd/isc.cpp jrd/divorce.cpp jrd/path_utils.cpp +FBGUARD_Other_Sources = jrd/isc.cpp jrd/divorce.cpp jrd/path_utils.cpp $(OS_SPECIFIC_Sources) FBGUARD_Files = guard.cpp util.cpp FBGUARD_Sources = $(addprefix utilities/guard/, $(FBGUARD_Files)) $(FBGUARD_Other_Sources) FBGUARD_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(FBGUARD_Sources)))) $(FBCLASSES_ClientObjects) diff -ur firebird.org/builds/posix/Makefile.in.embed.gfix firebird/builds/posix/Makefile.in.embed.gfix --- firebird.org/builds/posix/Makefile.in.embed.gfix 2014-07-03 13:40:07.000000000 +0200 +++ firebird/builds/posix/Makefile.in.embed.gfix 2014-07-03 13:54:55.000000000 +0200 @@ -43,7 +43,8 @@ alice.cpp exe.cpp tdr.cpp aliceMain.cpp GFIX_Other_Sources += jrd/isc.cpp jrd/ThreadData.cpp jrd/path_utils.cpp \ - common/UtilSvc.cpp + common/UtilSvc.cpp \ + $(OS_SPECIFIC_Sources) GFIX_Sources = $(addprefix alice/, $(GFIX_Files)) $(GFIX_Other_Sources) GFIX_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(GFIX_Sources)))) Only in firebird/builds/posix: Makefile.in.embed.gfix.orig Only in firebird/builds/posix: Makefile.in.embed.gfix.rej Only in firebird/builds/posix: Makefile.in.embed.gfix~ diff -ur firebird.org/builds/posix/Makefile.in.embed.util firebird/builds/posix/Makefile.in.embed.util --- firebird.org/builds/posix/Makefile.in.embed.util 2014-07-03 13:40:07.000000000 +0200 +++ firebird/builds/posix/Makefile.in.embed.util 2014-07-03 13:45:17.000000000 +0200 @@ -103,7 +103,7 @@ $(FBCLASSES_MsgObjects) $(CLUMPLETS_Objects) $(FBCOMMON_ClientObjects) -FBGUARD_Other_Sources = jrd/isc.cpp jrd/divorce.cpp jrd/path_utils.cpp +FBGUARD_Other_Sources = jrd/isc.cpp jrd/divorce.cpp jrd/path_utils.cpp $(OS_SPECIFIC_Sources) FBGUARD_Files = guard.cpp util.cpp FBGUARD_Sources = $(addprefix utilities/guard/, $(FBGUARD_Files)) $(FBGUARD_Other_Sources) FBGUARD_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(FBGUARD_Sources)))) $(FBCLASSES_ClientObjects) diff -ur firebird.org/builds/posix/prefix.aix_powerpc_xlc firebird/builds/posix/prefix.aix_powerpc_xlc --- firebird.org/builds/posix/prefix.aix_powerpc_xlc 2014-07-03 13:40:07.000000000 +0200 +++ firebird/builds/posix/prefix.aix_powerpc_xlc 2014-07-03 13:45:17.000000000 +0200 @@ -118,7 +118,7 @@ common/classes/MsgPrint.cpp common/classes/SafeArg.cpp \ common/classes/BaseStream.cpp common/classes/fb_string.cpp \ common/classes/TempFile.cpp \ - jrd/gds.cpp jrd/isc.cpp \ + jrd/gds.cpp jrd/isc.cpp $(OS_SPECIFIC_Sources)\ jrd/os/posix/path_utils.cpp jrd/os/posix/os_utils.cpp \ jrd/os/posix/config_root.cpp jrd/os/posix/fbsyslog.cpp Only in firebird: config.log Only in firebird: config.status Only in firebird/extern/btyacc: btyacc Only in firebird: gen Only in firebird: libtool Only in firebird/src/dsql: dsql.tab.h Only in firebird/src/dsql: parse.cpp Only in firebird/src/gpre: gpre_meta.cpp Only in firebird/src/include/gen: autoconfig.h Only in firebird/src/include/gen: blrtable.h diff -ur firebird.org/src/jrd/gds.cpp firebird/src/jrd/gds.cpp --- firebird.org/src/jrd/gds.cpp 2014-07-03 13:40:08.000000000 +0200 +++ firebird/src/jrd/gds.cpp 2014-07-03 13:45:17.000000000 +0200 @@ -200,8 +200,6 @@ static void sanitize(Firebird::string& locale); -static void safe_concat_path(TEXT* destbuf, const TEXT* srcbuf); - // New functions that try to be safe. static SLONG safe_interpret(char* const s, const size_t bufsize, const ISC_STATUS** const vector, bool legacy = false); @@ -1734,7 +1732,7 @@ GDS_init_prefix(); strcpy(resultString, fb_prefix); // safe - no BO - safe_concat_path(resultString, file); + iscSafeConcatPath(resultString, file); } @@ -1755,12 +1753,7 @@ GDS_init_prefix(); strcpy(string, fb_prefix_lock); // safe - no BO - - // if someone wants to know prefix for lock files, - // sooner of all he wants that directory to exist - os_utils::createLockDirectory(string); - - safe_concat_path(string, root); + iscSafeConcatPath(string, root); } @@ -1784,7 +1777,7 @@ GDS_init_prefix(); strcpy(string, fb_prefix_msg); // safe - no BO - safe_concat_path(string, root); + iscSafeConcatPath(string, root); } @@ -3553,43 +3546,6 @@ } } -static void safe_concat_path(TEXT *resultString, const TEXT *appendString) -{ -/************************************** - * - * s a f e _ c o n c a t _ p a t h - * - ************************************** - * - * Functional description - * Safely appends appendString to resultString using paths rules. - * resultString must be at most MAXPATHLEN size. - * Thread/signal safe code. - * - **************************************/ - size_t len = strlen(resultString); - fb_assert(len > 0); - - if (resultString[len - 1] != PathUtils::dir_sep && len < MAXPATHLEN - 1) - { - resultString[len++] = PathUtils::dir_sep; - resultString[len] = 0; - } - - size_t alen = strlen(appendString); - if (len + alen > MAXPATHLEN - 1) - { - alen = MAXPATHLEN - 1 - len; - } - - fb_assert(len < MAXPATHLEN); - fb_assert(alen < MAXPATHLEN); - fb_assert(len + alen < MAXPATHLEN); - - memcpy(&resultString[len], appendString, alen); - resultString[len + alen] = 0; -} - void FB_EXPORTED gds__default_printer(void* /*arg*/, SSHORT offset, const TEXT* line) { Only in firebird/src/jrd: gds.cpp.orig diff -ur firebird.org/src/jrd/isc.cpp firebird/src/jrd/isc.cpp --- firebird.org/src/jrd/isc.cpp 2014-07-03 13:40:08.000000000 +0200 +++ firebird/src/jrd/isc.cpp 2014-07-03 13:45:17.000000000 +0200 @@ -48,6 +48,8 @@ #include "../jrd/gds_proto.h" #include "../jrd/isc_proto.h" #include "../jrd/jrd_proto.h" +#include "../jrd/os/os_utils.h" +#include "../jrd/os/path_utils.h" #include "../common/classes/init.h" @@ -632,3 +634,61 @@ iscLogStatus(text, s); } + +void iscPrefixLock(TEXT* string, const TEXT* root, bool createLockDir) +{ +/************************************** + * + * i s c P r e f i x L o c k + * + ************************************** + * + * Functional description + * Find appropriate Firebird lock file prefix. + * + **************************************/ + gds__prefix_lock(string, ""); + + if (createLockDir) + os_utils::createLockDirectory(string); + + iscSafeConcatPath(string, root); +} + + +void iscSafeConcatPath(TEXT *resultString, const TEXT *appendString) +{ +/************************************** + * + * i s c S a f e C o n c a t P a t h + * + ************************************** + * + * Functional description + * Safely appends appendString to resultString using paths rules. + * resultString must be at most MAXPATHLEN size. + * Thread/signal safe code. + * + **************************************/ + size_t len = strlen(resultString); + fb_assert(len > 0); + + if (resultString[len - 1] != PathUtils::dir_sep && len < MAXPATHLEN - 1) + { + resultString[len++] = PathUtils::dir_sep; + resultString[len] = 0; + } + + size_t alen = strlen(appendString); + if (len + alen > MAXPATHLEN - 1) + { + alen = MAXPATHLEN - 1 - len; + } + + fb_assert(len < MAXPATHLEN); + fb_assert(alen < MAXPATHLEN); + fb_assert(len + alen < MAXPATHLEN); + + memcpy(&resultString[len], appendString, alen); + resultString[len + alen] = 0; +} diff -ur firebird.org/src/jrd/isc_proto.h firebird/src/jrd/isc_proto.h --- firebird.org/src/jrd/isc_proto.h 2014-07-03 13:40:08.000000000 +0200 +++ firebird/src/jrd/isc_proto.h 2014-07-03 13:45:17.000000000 +0200 @@ -44,4 +44,7 @@ struct _SECURITY_ATTRIBUTES* ISC_get_security_desc(); #endif +void iscPrefixLock(TEXT* string, const TEXT* root, bool createLockDir); +void iscSafeConcatPath(TEXT *resultString, const TEXT *appendString); + #endif // JRD_ISC_PROTO_H diff -ur firebird.org/src/jrd/isc_sync.cpp firebird/src/jrd/isc_sync.cpp --- firebird.org/src/jrd/isc_sync.cpp 2014-07-03 13:40:08.000000000 +0200 +++ firebird/src/jrd/isc_sync.cpp 2014-07-03 13:45:17.000000000 +0200 @@ -2296,7 +2296,7 @@ { #ifndef WIN_NT TEXT expanded_filename[MAXPATHLEN]; - gds__prefix_lock(expanded_filename, filename); + iscPrefixLock(expanded_filename, filename, false); // We can't do much (specially in dtors) when it fails // therefore do not check for errors - at least it's just /tmp. @@ -2332,7 +2332,7 @@ **************************************/ TEXT expanded_filename[MAXPATHLEN]; - gds__prefix_lock(expanded_filename, filename); + iscPrefixLock(expanded_filename, filename, true); /* make the complete filename for the init file this file is to be used as a master lock to eliminate possible race conditions with just a single file @@ -2340,7 +2340,7 @@ lock to a LCK_SHARED lock is not atomic*/ TEXT init_filename[MAXPATHLEN]; - gds__prefix_lock(init_filename, INIT_FILE); + iscPrefixLock(init_filename, INIT_FILE, true); const bool trunc_flag = (length != 0); @@ -2373,7 +2373,7 @@ if (fdSem < 0) { TEXT sem_filename[MAXPATHLEN]; - gds__prefix_lock(sem_filename, SEM_FILE); + iscPrefixLock(sem_filename, SEM_FILE, true); const int f = openFile(sem_filename); if (f == -1) { @@ -2554,7 +2554,7 @@ int retry_count = 0; TEXT expanded_filename[MAXPATHLEN]; - gds__prefix_lock(expanded_filename, filename); + iscPrefixLock(expanded_filename, filename, true); const bool trunc_flag = (length != 0); bool init_flag = false; @@ -4187,7 +4187,7 @@ CloseHandle(shmem_data->sh_mem_hdr_object); TEXT expanded_filename[MAXPATHLEN]; - gds__prefix_lock(expanded_filename, shmem_data->sh_mem_name); + iscPrefixLock(expanded_filename, shmem_data->sh_mem_name, false); // Delete file only if it is not used by anyone else HANDLE hFile = CreateFile(expanded_filename, Only in firebird/src/jrd: isc_sync.cpp.orig diff -ur firebird.org/src/jrd/svc.cpp firebird/src/jrd/svc.cpp --- firebird.org/src/jrd/svc.cpp 2014-07-03 13:40:08.000000000 +0200 +++ firebird/src/jrd/svc.cpp 2014-07-03 13:45:17.000000000 +0200 @@ -1360,7 +1360,7 @@ gds__prefix(auxBuf, ""); break; case isc_info_svc_get_env_lock: - gds__prefix_lock(auxBuf, ""); + iscPrefixLock(auxBuf, "", false); break; case isc_info_svc_get_env_msg: gds__prefix_msg(auxBuf, ""); @@ -1844,7 +1844,7 @@ gds__prefix(PathBuffer, ""); break; case isc_info_svc_get_env_lock: - gds__prefix_lock(PathBuffer, ""); + iscPrefixLock(PathBuffer, "", false); break; case isc_info_svc_get_env_msg: gds__prefix_msg(PathBuffer, ""); Only in firebird/src/jrd: svc.cpp.orig diff -ur firebird.org/src/jrd/trace/TraceConfigStorage.cpp firebird/src/jrd/trace/TraceConfigStorage.cpp --- firebird.org/src/jrd/trace/TraceConfigStorage.cpp 2014-07-03 13:40:08.000000000 +0200 +++ firebird/src/jrd/trace/TraceConfigStorage.cpp 2014-07-03 13:45:17.000000000 +0200 @@ -221,7 +221,7 @@ fb_assert(m_base->cnt_uses == 0); char dir[MAXPATHLEN]; - gds__prefix_lock(dir, ""); + iscPrefixLock(dir, "", true); PathName filename = TempFile::create("fb_trace_", dir); filename.copyTo(cfg_file_name, sizeof(m_base->cfg_file_name)); Only in firebird/src/jrd/trace: TraceConfigStorage.cpp.orig diff -ur firebird.org/src/jrd/trace/TraceLog.cpp firebird/src/jrd/trace/TraceLog.cpp --- firebird.org/src/jrd/trace/TraceLog.cpp 2014-07-03 13:40:08.000000000 +0200 +++ firebird/src/jrd/trace/TraceLog.cpp 2014-07-03 13:45:17.000000000 +0200 @@ -69,7 +69,7 @@ } char dir[MAXPATHLEN]; - gds__prefix_lock(dir, ""); + iscPrefixLock(dir, "", true); PathUtils::concatPath(m_baseFileName, dir, fileName); TraceLogGuard guard(this); Only in firebird/src/jrd/trace: TraceLog.cpp.orig Only in firebird/src/misc: codes.cpp Only in firebird: temp