noerr.h 825 B

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