From 54f4e8a91ff9087e55d375f8c48f893b956afb28 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Thu, 24 Sep 2009 14:11:47 +0530 Subject: [PATCH] Use correct format string for POSIX pid_t in pidfile_create() This patch also adds a gtk-doc comment for pidfile_create(). --- src/utils.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/utils.c b/src/utils.c index 239952c..ef2e673 100644 --- a/src/utils.c +++ b/src/utils.c @@ -177,10 +177,16 @@ int create_file_safely (const char *filename, unsigned int truncate_file) return fildes; } -/* - * Write the PID of the program to the specified file. - */ -int pidfile_create (const char *filename) +/** + * pidfile_create: + * @filename: The name of the file which should be created. + * + * 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; FILE *fd; @@ -203,7 +209,7 @@ int pidfile_create (const char *filename) return -EIO; } - fprintf (fd, "%ld\n", (long) getpid ()); + fprintf (fd, "%d\n", getpid ()); fclose (fd); return 0; }