MCPcopy Index your code
hub / github.com/RsyncProject/rsync / check

Function check

t_chmod_secure.c:33–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31static int errs = 0;
32
33static void check(const char *label, int actual_rc, int expect_ok,
34 const char *path, mode_t expected_mode)
35{
36 struct stat st;
37 int got_ok = (actual_rc == 0);
38 if (got_ok != expect_ok) {
39 fprintf(stderr, "FAIL [%s]: rc=%d errno=%d (%s), expected %s\n",
40 label, actual_rc, errno, strerror(errno),
41 expect_ok ? "success" : "rejection");
42 errs++;
43 return;
44 }
45 if (path && stat(path, &st) < 0) {
46 fprintf(stderr, "FAIL [%s]: stat(%s) failed: %s\n",
47 label, path, strerror(errno));
48 errs++;
49 return;
50 }
51 if (path && (st.st_mode & 07777) != expected_mode) {
52 fprintf(stderr,
53 "FAIL [%s]: %s mode is 0%o, expected 0%o\n",
54 label, path, st.st_mode & 07777, expected_mode);
55 errs++;
56 return;
57 }
58 fprintf(stderr, "OK [%s]\n", label);
59}
60
61int main(int argc, char **argv)
62{

Callers 1

mainFunction · 0.85

Calls 2

strerrorFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected