From: Sebastien Date: Fri, 20 Jul 2012 19:17:18 +0000 (+0200) Subject: Part of sadf -H was written to stderr instead of stdout. X-Git-Tag: v10.1.1~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63e7dcb9590e4d7ef3fd449b366790e4c89904b0;p=sysstat Part of sadf -H was written to stderr instead of stdout. A part of sadf -H output ("File created using...") was written to stderr instead of stdout. This is now fixed. --- diff --git a/CHANGES b/CHANGES index d2fd2ad..034dd1f 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,8 @@ xxxx/xx/xx: Version 10.1.1 - Sebastien Godard (sysstat orange.fr) activity. * [Peter Schiffer]: sar: Use /sys/dev/block/major:minor links to determine devices real name. + * Part of 'sadf -H' output was written to stderr instead of + stdout. This is now fixed. * [Peter Schiffer]: Various cosmetic changes in manual pages and usage messages displayed by sysstat commands. * sar and iostat manual pages updated. diff --git a/sa.h b/sa.h index f81f17b..72ec784 100644 --- a/sa.h +++ b/sa.h @@ -1,11 +1,13 @@ /* * sar/sadc: Report system activity - * (C) 1999-2011 by Sebastien Godard (sysstat orange.fr) + * (C) 1999-2012 by Sebastien Godard (sysstat orange.fr) */ #ifndef _SA_H #define _SA_H +#include + #include "common.h" #include "rd_stats.h" #include "rd_sensors.h" @@ -798,7 +800,7 @@ extern void extern int datecmp(struct tm *, struct tstamp *); extern void - display_sa_file_version(struct file_magic *); + display_sa_file_version(FILE *, struct file_magic *); extern void free_bitmaps(struct activity * []); extern void diff --git a/sa_common.c b/sa_common.c index 52a8704..67f1215 100644 --- a/sa_common.c +++ b/sa_common.c @@ -936,20 +936,21 @@ int sa_fread(int ifd, void *buffer, int size, int mode) * Display sysstat version used to create system activity data file. * * IN: - * @file_magic File magic header + * @st Output stream (stderr or stdout). + * @file_magic File magic header. *************************************************************************** */ -void display_sa_file_version(struct file_magic *file_magic) +void display_sa_file_version(FILE *st, struct file_magic *file_magic) { - fprintf(stderr, _("File created using sar/sadc from sysstat version %d.%d.%d"), + fprintf(st, _("File created using sar/sadc from sysstat version %d.%d.%d"), file_magic->sysstat_version, file_magic->sysstat_patchlevel, file_magic->sysstat_sublevel); if (file_magic->sysstat_extraversion) { - fprintf(stderr, ".%d", file_magic->sysstat_extraversion); + fprintf(st, ".%d", file_magic->sysstat_extraversion); } - fprintf(stderr, "\n"); + fprintf(st, "\n"); } /* @@ -976,7 +977,7 @@ void handle_invalid_sa_file(int *fd, struct file_magic *file_magic, char *file, if ((n == FILE_MAGIC_SIZE) && (file_magic->sysstat_magic == SYSSTAT_MAGIC)) { /* This is a sysstat file, but this file has an old format */ - display_sa_file_version(file_magic); + display_sa_file_version(stderr, file_magic); fprintf(stderr, _("Current sysstat version can no longer read the format of this file (%#x)\n"), diff --git a/sadf_misc.c b/sadf_misc.c index a041994..14d66f6 100644 --- a/sadf_misc.c +++ b/sadf_misc.c @@ -595,7 +595,7 @@ __printf_funct_t print_hdr_header(int *tab, int action, char *dfile, printf(_("System activity data file: %s (%#x)\n"), dfile, file_magic->format_magic); - display_sa_file_version(file_magic); + display_sa_file_version(stdout, file_magic); if (file_magic->format_magic != FORMAT_MAGIC) { return;