3
0

wfopen.c 388 B

1234567891011121314151617181920
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Utility routines.
  4. *
  5. * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  8. */
  9. #include "libbb.h"
  10. FILE *fopen_or_warn(const char *path, const char *mode)
  11. {
  12. FILE *fp = fopen(path, mode);
  13. if (!fp) {
  14. bb_perror_msg("%s", path);
  15. errno = 0;
  16. }
  17. return fp;
  18. }