]> git.ozlabs.org Git - ccan/blob - ccan/noerr/noerr.h
tal: allow notifiers on NULL.
[ccan] / ccan / noerr / noerr.h
1 /* CC0 (Public domain) - see LICENSE file for details */
2 #ifndef NOERR_H
3 #define NOERR_H
4 #include <stdio.h>
5
6 /**
7  * close_noerr - close without stomping errno.
8  * @fd: the file descriptor to close.
9  *
10  * errno is saved and restored across the call to close: if an error occurs,
11  * the resulting (non-zero) errno is returned.
12  */
13 int close_noerr(int fd);
14
15 /**
16  * fclose_noerr - close without stomping errno.
17  * @fp: the FILE pointer.
18  *
19  * errno is saved and restored across the call to fclose: if an error occurs,
20  * the resulting (non-zero) errno is returned.
21  */
22 int fclose_noerr(FILE *fp);
23
24 /**
25  * unlink_noerr - unlink a file without stomping errno.
26  * @pathname: the path to unlink.
27  *
28  * errno is saved and restored across the call to unlink: if an error occurs,
29  * the resulting (non-zero) errno is returned.
30  */
31 int unlink_noerr(const char *pathname);
32
33 /**
34  * free_noerr - free memory without stomping errno.
35  * @p: the pointer to free.
36  *
37  * errno is saved and restored across the call to free: the standard leaves
38  * that undefined.
39  */
40 void free_noerr(void *p);
41 #endif /* NOERR_H */