From ab6f76f6a9fc8028fff96322a52b770710ffa1a9 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 14 Feb 2007 09:32:16 +0000 Subject: [PATCH] Close the proper filedescriptor (if it exists). --- lib/pidfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pidfile.c b/lib/pidfile.c index 08d96dfe..830d3f35 100644 --- a/lib/pidfile.c +++ b/lib/pidfile.c @@ -85,12 +85,11 @@ pid_t write_pid (char *pidfile) pid_t pid; if ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1) { - close(fd); return 0; } if ((f = fdopen(fd, "r+")) == NULL) { - fclose(f); + close(fd); return 0; } -- 2.39.5