]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Invoke the unix open() system call through a wrapper to avoid problems
authordrh <drh@noemail.net>
Mon, 25 Apr 2011 18:01:27 +0000 (18:01 +0000)
committerdrh <drh@noemail.net>
Mon, 25 Apr 2011 18:01:27 +0000 (18:01 +0000)
resulting from differing declarations to that function in various systems.

FossilOrigin-Name: 4c7ff4dd352276e9c01cc536e188cbcd69396952

manifest
manifest.uuid
src/os_unix.c

index 8eaf9155202b0d97b916e58d083ed81c1a68fe18..b78804e62d748bbe8cea005ce48a7b879102a168 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Disable\sthe\stransfer\soptimization\sif\sthe\sdestination\stable\scontains\nany\sforeign\skey\sconstraint\sand\sforeign\skey\sconstraints\sare\senabled.\nTicket\s[6284df89debdf].
-D 2011-04-24T22:56:07.596
+C Invoke\sthe\sunix\sopen()\ssystem\scall\sthrough\sa\swrapper\sto\savoid\sproblems\s\nresulting\sfrom\sdiffering\sdeclarations\sto\sthat\sfunction\sin\svarious\ssystems.
+D 2011-04-25T18:01:27.439
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -162,7 +162,7 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d
 F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
-F src/os_unix.c d7889a0f9389c8c2e1d3b380f5aa1256c22a90e8
+F src/os_unix.c 2c67d126874b78eb427371db4793f0e8fbc7448b
 F src/os_win.c d149b9a7dfdd38de09afc054f8168cd3cd80630b
 F src/pager.c 055239dcdfe12b3f5d97f6f01f85da01e2d6d912
 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
@@ -930,7 +930,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 0ab24b133e332ad7f4517b8e113e9c241ee9af9f
-R 40e74cf200b39d155b455f390ce862eb
+P ddeea5ab5f6c0c4a86cdfbbb9f24d9d54bf8d301
+R c3c570e59b4504f5792e40be1884b2ad
 U drh
-Z 87bc3e585b95e6d3397bca153c02ab82
+Z 99b5b07687fe54475ef75b698d77b786
index 6503aa6c356d33a0f90246271f45bcd64e892155..f4b8a8d7269a7a703f382ec076a77a5c38b9b294 100644 (file)
@@ -1 +1 @@
-ddeea5ab5f6c0c4a86cdfbbb9f24d9d54bf8d301
\ No newline at end of file
+4c7ff4dd352276e9c01cc536e188cbcd69396952
\ No newline at end of file
index 2d3a616373fc9e1ca642fb0f5f6ec0cfb669f7d8..a760e2c1473033e8e8ae6bd25efa2c8130cf9542 100644 (file)
@@ -281,6 +281,18 @@ struct unixFile {
 #define threadid 0
 #endif
 
+/*
+** Different Unix systems declare open() in different ways.  Same use
+** open(const char*,int,mode_t).  Others use open(const char*,int,...).
+** The difference is important when using a pointer to the function.
+**
+** The safest way to deal with the problem is to always use this wrapper
+** which always has the same well-defined interface.
+*/
+static int posixOpen(const char *zFile, int flags, int mode){
+  return open(zFile, flags, mode);
+}
+
 /*
 ** Many system calls are accessed through pointer-to-functions so that
 ** they may be overridden at runtime to facilitate fault injection during
@@ -292,8 +304,8 @@ static struct unix_syscall {
   sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
   sqlite3_syscall_ptr pDefault; /* Default value */
 } aSyscall[] = {
-  { "open",         (sqlite3_syscall_ptr)open,       0  },
-#define osOpen      ((int(*)(const char*,int,...))aSyscall[0].pCurrent)
+  { "open",         (sqlite3_syscall_ptr)posixOpen,  0  },
+#define osOpen      ((int(*)(const char*,int,int))aSyscall[0].pCurrent)
 
   { "close",        (sqlite3_syscall_ptr)close,      0  },
 #define osClose     ((int(*)(int))aSyscall[1].pCurrent)