Use correct format string for POSIX pid_t in pidfile_create()

This patch also adds a gtk-doc comment for pidfile_create().
master
Mukund Sivaraman 2009-09-24 14:11:47 +05:30
parent 43d0af85af
commit 54f4e8a91f
1 changed files with 11 additions and 5 deletions

View File

@ -177,10 +177,16 @@ int create_file_safely (const char *filename, unsigned int truncate_file)
return fildes; return fildes;
} }
/* /**
* Write the PID of the program to the specified file. * pidfile_create:
*/ * @filename: The name of the file which should be created.
int pidfile_create (const char *filename) *
* Creates a file with the PID of the Tinyproxy process.
*
* Returns: %0 on success, non-zero values on errors.
**/
int
pidfile_create (const char *filename)
{ {
int fildes; int fildes;
FILE *fd; FILE *fd;
@ -203,7 +209,7 @@ int pidfile_create (const char *filename)
return -EIO; return -EIO;
} }
fprintf (fd, "%ld\n", (long) getpid ()); fprintf (fd, "%d\n", getpid ());
fclose (fd); fclose (fd);
return 0; return 0;
} }