noerr.h 882 B

123456789101112131415161718192021222324252627282930313233
  1. /* CC0 (Public domain) - see LICENSE file for details */
  2. #ifndef NOERR_H
  3. #define NOERR_H
  4. #include <stdio.h>
  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. * fclose_noerr - close without stomping errno.
  15. * @fp: the FILE pointer.
  16. *
  17. * errno is saved and restored across the call to fclose: if an error occurs,
  18. * the resulting (non-zero) errno is returned.
  19. */
  20. int fclose_noerr(FILE *fp);
  21. /**
  22. * unlink_noerr - unlink a file without stomping errno.
  23. * @pathname: the path to unlink.
  24. *
  25. * errno is saved and restored across the call to unlink: if an error occurs,
  26. * the resulting (non-zero) errno is returned.
  27. */
  28. int unlink_noerr(const char *pathname);
  29. #endif /* NOERR_H */