From 2758d2a1d34ab37a1af78e88984a7b4a9250975f Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 26 Dec 2013 10:39:09 -0500 Subject: [PATCH] meminfo-writer: kill child if we error out due to failure to write the pid file --- qmemman/meminfo-writer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qmemman/meminfo-writer.c b/qmemman/meminfo-writer.c index 517af94..7b2df7a 100644 --- a/qmemman/meminfo-writer.c +++ b/qmemman/meminfo-writer.c @@ -137,11 +137,13 @@ int main(int argc, char **argv) fd = open(argv[3], O_CREAT | O_TRUNC | O_WRONLY, 0666); if (fd < 0) { perror("open pidfile"); + kill(pid,9); exit(1); } n = sprintf(buf, "%d\n", pid); if (write(fd, buf, n) != n) { perror("write pid"); + kill(pid,9); exit(1); } close(fd);