* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
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;
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);
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;
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",
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);