summaryrefslogtreecommitdiff
path: root/ccan/noerr/noerr.h
blob: 99b0f69043ac458672597a7a3932a989528f491d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* CC0 (Public domain) - see LICENSE file for details */
#ifndef NOERR_H
#define NOERR_H
#include <stdio.h>

/**
 * close_noerr - close without stomping errno.
 * @fd: the file descriptor to close.
 *
 * errno is saved and restored across the call to close: if an error occurs,
 * the resulting (non-zero) errno is returned.
 */
int close_noerr(int fd);

/**
 * fclose_noerr - close without stomping errno.
 * @fp: the FILE pointer.
 *
 * errno is saved and restored across the call to fclose: if an error occurs,
 * the resulting (non-zero) errno is returned.
 */
int fclose_noerr(FILE *fp);

/**
 * unlink_noerr - unlink a file without stomping errno.
 * @pathname: the path to unlink.
 *
 * errno is saved and restored across the call to unlink: if an error occurs,
 * the resulting (non-zero) errno is returned.
 */
int unlink_noerr(const char *pathname);

#endif /* NOERR_H */