MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_flopen_open

Function test_flopen_open

tools/libutil/tests/flopen_test.c:68–89  ·  view source on GitHub ↗

* Test that flopen() can open an existing file. */

Source from the content-addressed store, hash-verified

66 * Test that flopen() can open an existing file.
67 */
68const char *
69test_flopen_open(void)
70{
71 const char *fn = "test_flopen_open";
72 const char *result = NULL;
73 int fd;
74
75 fd = open(fn, O_RDWR|O_CREAT, 0640);
76 if (fd < 0) {
77 result = strerror(errno);
78 } else {
79 close(fd);
80 fd = flopen(fn, O_RDWR);
81 if (fd < 0) {
82 result = strerror(errno);
83 } else {
84 close(fd);
85 }
86 }
87 unlink(fn);
88 return (result);
89}
90
91/*
92 * Test that flopen() can lock against itself

Callers

nothing calls this directly

Calls 2

flopenFunction · 0.85
closeFunction · 0.50

Tested by

no test coverage detected