aboutsummaryrefslogtreecommitdiffstats
path: root/pid.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-03 03:47:04 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-03 03:47:04 +0000
commit9ef4282e9e32e857f4d0cac9df6d58f2cba159f4 (patch)
tree723676ea31fe0615b4d0caca1491e5a21fe85c7a /pid.c
parentd0b39b590e56b191394cfcb6b8690de0fbd87957 (diff)
downloadlcd4linux-9ef4282e9e32e857f4d0cac9df6d58f2cba159f4.tar.gz
[lcd4linux @ 2004-03-03 03:47:04 by reinelt]
big patch from Martin Hejl: - use qprintf() where appropriate - save CPU cycles on gettimeofday() - add quit() functions to free allocated memory - fixed lots of memory leaks git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@384 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'pid.c')
-rw-r--r--pid.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/pid.c b/pid.c
index bdf7737..743470a 100644
--- a/pid.c
+++ b/pid.c
@@ -1,4 +1,4 @@
-/* $Id: pid.c,v 1.3 2004/01/29 04:40:02 reinelt Exp $
+/* $Id: pid.c,v 1.4 2004/03/03 03:47:04 reinelt Exp $
*
* PID file handling
*
@@ -22,6 +22,13 @@
*
*
* $Log: pid.c,v $
+ * Revision 1.4 2004/03/03 03:47:04 reinelt
+ * big patch from Martin Hejl:
+ * - use qprintf() where appropriate
+ * - save CPU cycles on gettimeofday()
+ * - add quit() functions to free allocated memory
+ * - fixed lots of memory leaks
+ *
* Revision 1.3 2004/01/29 04:40:02 reinelt
* every .c file includes "config.h" now
*
@@ -62,7 +69,7 @@
#include "debug.h"
#include "pid.h"
-
+#include "qprintf.h"
int pid_init (const char *pidfile)
{
@@ -70,7 +77,7 @@ int pid_init (const char *pidfile)
char buffer[16];
int fd, len, pid;
- snprintf(tmpfile, sizeof(tmpfile), "%s.%s", pidfile, "XXXXXX");
+ qprintf(tmpfile, sizeof(tmpfile), "%s.%s", pidfile, "XXXXXX");
if ((fd=mkstemp(tmpfile))==-1) {
error ("mkstemp(%s) failed: %s", tmpfile, strerror(errno));
@@ -84,7 +91,7 @@ int pid_init (const char *pidfile)
return -1;
}
- snprintf (buffer, sizeof(buffer), "%d\n", (int)getpid());
+ qprintf(buffer, sizeof(buffer), "%d\n", (int)getpid());
if (write(fd, buffer, strlen(buffer))!=strlen(buffer)) {
error ("write(%s) failed: %s", tmpfile, strerror(errno));
close(fd);