svn commit: r226986 - head/usr.sbin/pmcstat
Fabien Thomas
fabient at FreeBSD.org
Tue Nov 1 09:28:48 UTC 2011
Author: fabient
Date: Tue Nov 1 09:28:47 2011
New Revision: 226986
URL: http://svn.freebsd.org/changeset/base/226986
Log:
Two bugs fixed:
- Do not close stdout or stderr when redirecting to file.
- Correctly handle error code to detect when no buffer available.
MFC after: 1 month
Modified:
head/usr.sbin/pmcstat/pmcstat.c
Modified: head/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat.c Tue Nov 1 08:57:49 2011 (r226985)
+++ head/usr.sbin/pmcstat/pmcstat.c Tue Nov 1 09:28:47 2011 (r226986)
@@ -796,7 +796,9 @@ main(int argc, char **argv)
break;
case 'o': /* outputfile */
- if (args.pa_printfile != NULL)
+ if (args.pa_printfile != NULL &&
+ args.pa_printfile != stdout &&
+ args.pa_printfile != stderr)
(void) fclose(args.pa_printfile);
if ((args.pa_printfile = fopen(optarg, "w")) == NULL)
errx(EX_OSERR, "ERROR: cannot open \"%s\" for "
@@ -1394,7 +1396,7 @@ main(int argc, char **argv)
case EVFILT_TIMER: /* print out counting PMCs */
if ((args.pa_flags & FLAG_DO_TOP) &&
- pmc_flush_logfile() != ENOBUFS)
+ pmc_flush_logfile() == 0)
do_read = 1;
do_print = 1;
break;
More information about the svn-src-head
mailing list