mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
r11581@Kushana: nickm | 2006-12-15 00:12:24 -0500
Make PIDFile work on windows. Reported by Arrakis. svn:r9116
This commit is contained in:
@@ -13,6 +13,7 @@ Changes in version 0.1.2.5-xxxx - 200?-??-??
|
||||
a timely fashion.
|
||||
- Ongoing work on eventdns infrastructure: add dns server and ipv6
|
||||
support.
|
||||
- Make PIDFile work on Windows (untested).
|
||||
|
||||
o Major bugfixes:
|
||||
- Fix a longstanding bug in eventdns that prevented the count of
|
||||
|
||||
+5
-2
@@ -24,6 +24,7 @@ const char util_c_id[] = "$Id$";
|
||||
#ifdef MS_WINDOWS
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#include <pwd.h>
|
||||
@@ -2015,16 +2016,18 @@ finish_daemon(const char *cp)
|
||||
void
|
||||
write_pidfile(char *filename)
|
||||
{
|
||||
#ifndef MS_WINDOWS
|
||||
FILE *pidfile;
|
||||
|
||||
if ((pidfile = fopen(filename, "w")) == NULL) {
|
||||
log_warn(LD_FS, "Unable to open \"%s\" for writing: %s", filename,
|
||||
strerror(errno));
|
||||
} else {
|
||||
#ifdef MS_WINDOWS
|
||||
fprintf(pidfile, "%d\n", (int)_getpid());
|
||||
#else
|
||||
fprintf(pidfile, "%d\n", (int)getpid());
|
||||
#endif
|
||||
fclose(pidfile);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user