This file is indexed.

/var/lib/pcp/testsuite/src/clientid.c is in pcp-testsuite 3.9.10.

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * Exercise __pmSetClientId()
 *
 * Copyright (c) 2009 Ken McDonell.  All Rights Reserved.
 */

#include <ctype.h>
#include <pcp/pmapi.h>
#include <pcp/impl.h>

#define TAG "QA-clientid "

int
main(int argc, char *argv[])
{
    int		ctx;
    int		sts;
    int		c;
    int		a;
    int		lflag = 0;
    int		errflag = 0;
    static char	*usage = "[-l] [-D debugopts]";

    __pmSetProgname(argv[0]);

    while ((c = getopt(argc, argv, "D:l")) != EOF) {
	switch (c) {

#ifdef PCP_DEBUG
	case 'D':	/* debug flag */
	    sts = __pmParseDebug(optarg);
	    if (sts < 0) {
		fprintf(stderr, "%s: unrecognized debug flag specification (%s)\n",
		    pmProgname, optarg);
		errflag++;
	    }
	    else
		pmDebug |= sts;
	    break;
#endif

	case 'l':	/* linger when done */
	    lflag = 1;
	    break;

	case '?':
	default:
	    errflag++;
	    break;
	}
    }

    if (errflag) {
	printf("Usage: %s %s\n", pmProgname, usage);
	exit(1);
    }

    fprintf(stderr, "Error expected ...\n");
    if ((sts = __pmSetClientId("no context yet, bozo")) < 0) {
	fprintf(stderr, "__pmSetClientId(...): %s\n",
		pmErrStr(sts));
    }

    if ((ctx = pmNewContext(PM_CONTEXT_HOST, "localhost")) < 0) {
	fprintf(stderr, "pmNewContext(..., \"localhost\"): %s\n",
		pmErrStr(ctx));
	exit(1);
    }

    for (a = optind; a < argc; a++) {
	char	*cp;
	cp = (char *)malloc(strlen(argv[a])+strlen(TAG)+1);
	strcpy(cp, TAG);
	strcat(cp, argv[a]);
	if ((sts = __pmSetClientId(cp)) < 0) {
	    fprintf(stderr, "__pmSetClientId(%s): %s\n",
		    cp, pmErrStr(sts));
	}
	else {
	    sts = system("pminfo -f pmcd.client.whoami");
	    if (sts != 0)
		fprintf(stderr, "Warning: pminfo command: exit status %d\n", sts);
	}
	free(cp);
    }

    if (lflag)
	pause();

    exit(0);
}