From 8cfb4353c2f65ba905756c3d33c00cd31621aab9 Mon Sep 17 00:00:00 2001 From: Joseph Koshy Date: Tue, 23 Dec 2008 12:08:06 +0000 Subject: [PATCH] Close the read side of the pipe to self when exiting. --- usr.sbin/pmcstat/pmcstat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c index ea7264c3d2c2..6496ddbeb1a0 100644 --- a/usr.sbin/pmcstat/pmcstat.c +++ b/usr.sbin/pmcstat/pmcstat.c @@ -1264,6 +1264,9 @@ main(int argc, char **argv) /* Kill the child process if we started it */ if (args.pa_flags & FLAG_HAS_COMMANDLINE) pmcstat_kill_process(&args); + /* Close the pipe to self, if present. */ + if (args.pa_flags & FLAG_HAS_PIPE) + (void) close(pipefd[READPIPEFD]); runstate = PMCSTAT_FINISHED; } else if (kev.ident == SIGWINCH) { if (ioctl(fileno(args.pa_printfile),