X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fnoerr%2Fnoerr.h;h=bafb59bd021d5ff76d3f6c215afb837d8a2783a5;hb=a240178097376329b4567a6728952daa89362771;hp=559ba6132840543f4d9a2e4fa1dcb07cb9cdf6fb;hpb=650c775ff00cccd03fc84e7789a03c51d9839004;p=ccan diff --git a/ccan/noerr/noerr.h b/ccan/noerr/noerr.h index 559ba613..bafb59bd 100644 --- a/ccan/noerr/noerr.h +++ b/ccan/noerr/noerr.h @@ -1,5 +1,7 @@ +/* CC0 (Public domain) - see LICENSE file for details */ #ifndef NOERR_H #define NOERR_H +#include /** * close_noerr - close without stomping errno. @@ -10,6 +12,15 @@ */ 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. @@ -19,4 +30,12 @@ int close_noerr(int fd); */ int unlink_noerr(const char *pathname); +/** + * free_noerr - free memory without stomping errno. + * @p: the pointer to free. + * + * errno is saved and restored across the call to free: the standard leaves + * that undefined. + */ +void free_noerr(void *p); #endif /* NOERR_H */