Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf header: Fix up argument to ctime()

Reducing this noise when cross building to the Android NDK:

util/header.c: In function 'perf_header__fprintf_info':
util/header.c:2710:45: warning: pointer targets in passing argument 1 of 'ctime' differ in signedness [-Wpointer-sign]
fprintf(fp, "# captured on : %s", ctime(&st.st_ctime));
^
In file included from util/../perf.h:5:0,
from util/evlist.h:11,
from util/header.c:22:
/opt/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/time.h:81:14: note: expected 'const time_t *' but argument is of type 'long unsigned int *'
extern char* ctime(const time_t*) __LIBC_ABI_PUBLIC__;
^

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-6bz74zp080yhmtiwb36enso9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+3 -1
+3 -1
tools/perf/util/header.c
··· 2698 2698 struct perf_header *header = &session->header; 2699 2699 int fd = perf_data__fd(session->data); 2700 2700 struct stat st; 2701 + time_t stctime; 2701 2702 int ret, bit; 2702 2703 2703 2704 hd.fp = fp; ··· 2708 2707 if (ret == -1) 2709 2708 return -1; 2710 2709 2711 - fprintf(fp, "# captured on : %s", ctime(&st.st_ctime)); 2710 + stctime = st.st_ctime; 2711 + fprintf(fp, "# captured on : %s", ctime(&stctime)); 2712 2712 2713 2713 fprintf(fp, "# header version : %u\n", header->version); 2714 2714 fprintf(fp, "# data offset : %" PRIu64 "\n", header->data_offset);