aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-02-06 16:54:01 +0000
committerYang Tse <yangsita@gmail.com>2008-02-06 16:54:01 +0000
commitfecb67b246a2a2dad900edaab28f4e046ef47822 (patch)
tree6e73a914a37be6dffd841aa7256de97ca17629d3 /tests/server
parent2c0956200ffe6c9a42d80a6077fe172c3f7bac53 (diff)
Use a long int data type to handle getpid() result
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/sockfilt.c8
-rw-r--r--tests/server/sws.c6
-rw-r--r--tests/server/tftpd.c9
3 files changed, 15 insertions, 8 deletions
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index e5a605157..9962a4c40 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -671,10 +671,10 @@ int main(int argc, char *argv[])
pidfile = fopen(pidname, "w");
if(pidfile) {
- int pid = (int)getpid();
- fprintf(pidfile, "%d\n", pid);
+ long pid = (long)getpid();
+ fprintf(pidfile, "%ld\n", pid);
fclose(pidfile);
- logmsg("Wrote pid %d to %s", pid, pidname);
+ logmsg("Wrote pid %ld to %s", pid, pidname);
}
else {
error = ERRNO;
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 0bbd124f3..695c6b156 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -670,7 +670,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
case DOCNUMBER_WERULEZ:
/* we got a "friends?" question, reply back that we sure are */
logmsg("Identifying ourselves as friends");
- sprintf(msgbuf, "WE ROOLZ: %d\r\n", (int)getpid());
+ sprintf(msgbuf, "WE ROOLZ: %ld\r\n", (long)getpid());
msglen = strlen(msgbuf);
sprintf(weare, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s",
msglen, msgbuf);
@@ -948,8 +948,10 @@ int main(int argc, char *argv[])
pidfile = fopen(pidname, "w");
if(pidfile) {
- fprintf(pidfile, "%d\n", (int)getpid());
+ long pid = (long)getpid();
+ fprintf(pidfile, "%ld\n", pid);
fclose(pidfile);
+ logmsg("Wrote pid %ld to %s", pid, pidname);
}
else {
error = ERRNO;
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index d4a4b53c5..c8393a047 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -505,19 +505,24 @@ int main(int argc, char **argv)
if(rc < 0) {
perror("binding stream socket");
logmsg("Error binding socket");
+ sclose(sock);
return 1;
}
pidfile = fopen(pidname, "w");
if(pidfile) {
- fprintf(pidfile, "%d\n", (int)getpid());
+ long pid = (long)getpid();
+ fprintf(pidfile, "%ld\n", pid);
fclose(pidfile);
+ logmsg("Wrote pid %ld to %s", pid, pidname);
}
else {
error = ERRNO;
logmsg("fopen() failed with error: %d %s", error, strerror(error));
logmsg("Error opening file: %s", pidname);
logmsg("Couldn't write pid file");
+ sclose(sock);
+ return 1;
}
logmsg("Running IPv%d version on port UDP/%d",
@@ -662,7 +667,7 @@ static int validate_access(struct testcase *test,
if(!strncmp("verifiedserver", filename, 15)) {
char weare[128];
- size_t count = sprintf(weare, "WE ROOLZ: %d\r\n", (int)getpid());
+ size_t count = sprintf(weare, "WE ROOLZ: %ld\r\n", (long)getpid());
logmsg("Are-we-friendly question received");
test->buffer = strdup(weare);