1 #include "noerr/noerr.h"
3 #include "noerr/noerr.c"
10 int main(int argc, char *argv[])
12 /* tempnam(3) is generally a bad idea, but OK here. */
13 char *name = tempnam(NULL, "noerr");
17 /* Should fail to unlink. */
18 ok1(unlink(name) != 0);
21 /* This one should not set errno. */
23 ok1(unlink_noerr(name) == ENOENT);
26 /* Should fail to close. */
30 /* This one should not set errno. */
32 ok1(close_noerr(-1) == EBADF);
35 /* Test successful close/unlink doesn't hit errno either. */
36 fd = open(name, O_WRONLY|O_CREAT|O_EXCL, 0600);
40 ok1(close_noerr(fd) == 0);
44 ok1(unlink_noerr(name) == 0);