aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2020-04-11 23:40:45 +0200
committerMarc Hoersken <info@marc-hoersken.de>2020-04-11 23:46:30 +0200
commitdd0365d560aea5a1ad45b479636fb4fffddedace (patch)
tree1e3c0187a30872ec3042f10e26edad3e20cb5409 /tests/server
parentc1951cdb38817c4c7ba14535140912f5f69ae982 (diff)
tests/server/util.c: use curl_off_t instead of long for pid
Avoid potential overflow of huge PIDs on Windows. Related to #5188 Assisted-by: Marcel Raad
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/server/util.c b/tests/server/util.c
index fa3d45118..24f9497ae 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -261,9 +261,9 @@ int wait_ms(int timeout_ms)
int write_pidfile(const char *filename)
{
FILE *pidfile;
- long pid;
+ curl_off_t pid;
- pid = (long)getpid();
+ pid = (curl_off_t)getpid();
pidfile = fopen(filename, "wb");
if(!pidfile) {
logmsg("Couldn't write pid file: %s %s", filename, strerror(errno));
@@ -278,7 +278,7 @@ int write_pidfile(const char *filename)
*/
pid += 65536;
#endif
- fprintf(pidfile, "%ld\n", pid);
+ fprintf(pidfile, "%" CURL_FORMAT_CURL_OFF_T "\n", pid);
fclose(pidfile);
logmsg("Wrote pid %ld to %s", pid, filename);
return 1; /* success */