Fossil SCM

Fix the code for obtaining process ids on windows.

drh 2018-07-18 16:54 UTC backoffice
Commit 4695f217ce5e1bd7df1b5947331bc12fbb25dc8226062131f670211d96c3d24d
1 file changed +5 -5
--- src/backoffice.c
+++ src/backoffice.c
@@ -39,11 +39,13 @@
3939
** will restart using the new binary automatically.
4040
*/
4141
#include "config.h"
4242
#include "backoffice.h"
4343
#include <time.h>
44
-#if !defined(_WIN32)
44
+#if defined(_WIN32)
45
+# include <windows.h>
46
+#else
4547
# include <sys/types.h>
4648
# include <signal.h>
4749
#endif
4850
4951
/*
@@ -141,15 +143,13 @@
141143
/*
142144
** Return a process id number for the current process
143145
*/
144146
static sqlite3_uint64 backofficeProcessId(void){
145147
#if defined(_WIN32)
146
- ULONG Id = 0;
147
- GetCurrentProcessId(&Id);
148
- return Id;
148
+ return (sqlite3_uint64)GetCurrentProcessId();
149149
#else
150
- return getpid();
150
+ return (sqlite3_uint64)getpid();
151151
#endif
152152
}
153153
154154
/*
155155
** COMMAND: test-process-id
156156
--- src/backoffice.c
+++ src/backoffice.c
@@ -39,11 +39,13 @@
39 ** will restart using the new binary automatically.
40 */
41 #include "config.h"
42 #include "backoffice.h"
43 #include <time.h>
44 #if !defined(_WIN32)
 
 
45 # include <sys/types.h>
46 # include <signal.h>
47 #endif
48
49 /*
@@ -141,15 +143,13 @@
141 /*
142 ** Return a process id number for the current process
143 */
144 static sqlite3_uint64 backofficeProcessId(void){
145 #if defined(_WIN32)
146 ULONG Id = 0;
147 GetCurrentProcessId(&Id);
148 return Id;
149 #else
150 return getpid();
151 #endif
152 }
153
154 /*
155 ** COMMAND: test-process-id
156
--- src/backoffice.c
+++ src/backoffice.c
@@ -39,11 +39,13 @@
39 ** will restart using the new binary automatically.
40 */
41 #include "config.h"
42 #include "backoffice.h"
43 #include <time.h>
44 #if defined(_WIN32)
45 # include <windows.h>
46 #else
47 # include <sys/types.h>
48 # include <signal.h>
49 #endif
50
51 /*
@@ -141,15 +143,13 @@
143 /*
144 ** Return a process id number for the current process
145 */
146 static sqlite3_uint64 backofficeProcessId(void){
147 #if defined(_WIN32)
148 return (sqlite3_uint64)GetCurrentProcessId();
 
 
149 #else
150 return (sqlite3_uint64)getpid();
151 #endif
152 }
153
154 /*
155 ** COMMAND: test-process-id
156

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button