/var/lib/pcp/testsuite/src/pmsprintf.c is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /*
* Copyright (c) 2017 Red Hat.
*/
#include <pcp/pmapi.h>
int
main(int argc, char *argv[])
{
char str[16];
int sts;
int i = 0;
memset(str, '~', sizeof(str));
sts = pmsprintf(str, 16, "[%d] %s", i++, "test");
printf("[%d] pmsprintf strlen=%d str='%s'\n", i, sts, str);
memset(str, '~', sizeof(str));
sts = pmsprintf(str, 3, "[%d] %s", i++, "test");
printf("[%d] pmsprintf strlen=%d str='%s'\n", i, sts, str);
memset(str, '~', sizeof(str));
sts = pmsprintf(str, 0, "[%d] %s", i++, "test");
printf("[%d] pmsprintf strlen=%d str='%.*s'\n", i, sts, 16, str);
memset(str, '~', sizeof(str));
sts = pmsprintf(str, 1, "[%d] %s", i++, "test");
printf("[%d] pmsprintf strlen=%d str='%s'\n", i, sts, str);
memset(str, '~', sizeof(str));
sts = pmsprintf(str, 2, "[%d] %s", i++, "test");
printf("[%d] pmsprintf strlen=%d str='%s'\n", i, sts, str);
exit(0);
}
|