From 9674fe64988a2762cc0457aec68079e9fd4e5ac9 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sun, 13 Dec 2020 16:11:15 +0100 Subject: [PATCH] sar/sadc: Use %z format specifier for size_t values As indicated in the ssize_t(3) manual page. Signed-off-by: Sebastien GODARD --- sadc.c | 12 ++++++------ sar.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sadc.c b/sadc.c index 7db7e93..b4cc6ad 100644 --- a/sadc.c +++ b/sadc.c @@ -304,10 +304,10 @@ void reset_stats(void) /* *************************************************************************** * Count activities items then allocate and init corresponding structures. - * Activities such A_CPU with AO_ALWAYS_COUNTED flag set are always counted - * (thus the number of CPU will always be counted even if CPU activity is - * not collected), but ONLY those that will be collected have allocated - * structures. + * Activities such as A_CPU with AO_ALWAYS_COUNTED flag set are always + * counted (thus the number of CPU will always be counted even if CPU + * activity is not collected), but ONLY those that will be collected have + * allocated structures. * This function is called when sadc is started, and when a file is rotated. * If a file is rotated and structures are reallocated with a larger size, * additional space is not initialized: It doesn't matter as reset_stats() @@ -821,7 +821,7 @@ void open_ofile(int *ofd, char ofile[], int restart_mark) return; } #ifdef DEBUG - fprintf(stderr, "%s: Size read=%ld sysstat_magic=%x format_magic=%x header_size=%u header=%d,%d,%d\n", + fprintf(stderr, "%s: Size read=%zd sysstat_magic=%x format_magic=%x header_size=%u header=%d,%d,%d\n", __FUNCTION__, sz, file_magic.sysstat_magic, file_magic.format_magic, file_magic.header_size, file_magic.hdr_types_nr[0], file_magic.hdr_types_nr[1], file_magic.hdr_types_nr[2]); #endif @@ -832,7 +832,7 @@ void open_ofile(int *ofd, char ofile[], int restart_mark) /* Read file standard header */ if ((sz = read(*ofd, &file_hdr, FILE_HEADER_SIZE)) != FILE_HEADER_SIZE) { #ifdef DEBUG - fprintf(stderr, "%s: Size read=%ld\n", + fprintf(stderr, "%s: Size read=%zd\n", __FUNCTION__, sz); #endif goto append_error; diff --git a/sar.c b/sar.c index 372f486..5d36ebd 100644 --- a/sar.c +++ b/sar.c @@ -936,7 +936,7 @@ void read_header_data(void) if ((file_hdr.act_size != FILE_ACTIVITY_SIZE) || (file_hdr.rec_size != RECORD_HEADER_SIZE)) { #ifdef DEBUG - fprintf(stderr, "%s: act_size=%u/%lu rec_size=%u/%lu\n", __FUNCTION__, + fprintf(stderr, "%s: act_size=%u/%zu rec_size=%u/%zu\n", __FUNCTION__, file_hdr.act_size, FILE_ACTIVITY_SIZE, file_hdr.rec_size, RECORD_HEADER_SIZE); #endif print_read_error(INCONSISTENT_INPUT_DATA); -- 2.40.0