summaryrefslogtreecommitdiff
path: root/external/firebird/firebird-no-open-temp-on-shutdown.patch.1
blob: 5ce748ca8e5dff0f6325275cc17fded96efcb500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
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