]> git.ozlabs.org Git - ccan/blob - ccan/noerr/noerr.h
talloc: allow replacement allocator
[ccan] / ccan / noerr / noerr.h
1 #ifndef NOERR_H
2 #define NOERR_H
3 #include <stdio.h>
4
5 /**
6  * close_noerr - close without stomping errno.
7  * @fd: the file descriptor to close.
8  *
9  * errno is saved and restored across the call to close: if an error occurs,
10  * the resulting (non-zero) errno is returned.
11  */
12 int close_noerr(int fd);
13
14 /**
15  * fclose_noerr - close without stomping errno.
16  * @fp: the FILE pointer.
17  *
18  * errno is saved and restored across the call to fclose: if an error occurs,
19  * the resulting (non-zero) errno is returned.
20  */
21 int fclose_noerr(FILE *fp);
22
23 /**
24  * unlink_noerr - unlink a file without stomping errno.
25  * @pathname: the path to unlink.
26  *
27  * errno is saved and restored across the call to unlink: if an error occurs,
28  * the resulting (non-zero) errno is returned.
29  */
30 int unlink_noerr(const char *pathname);
31
32 #endif /* NOERR_H */