Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/fclose_nonstdin.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/libbb/fclose_nonstdin.c
r1765 r2725 5 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 6 6 * 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 … … 15 15 #include "libbb.h" 16 16 17 int fclose_if_not_stdin(FILE *f)17 int FAST_FUNC fclose_if_not_stdin(FILE *f) 18 18 { 19 if (f != stdin) { 20 return fclose(f); 21 } 22 return 0; 19 /* Some more paranoid applets want ferror() check too */ 20 int r = ferror(f); /* NB: does NOT set errno! */ 21 if (r) errno = EIO; /* so we'll help it */ 22 if (f != stdin) 23 return (r | fclose(f)); /* fclose does set errno on error */ 24 return r; 23 25 }
Note:
See TracChangeset
for help on using the changeset viewer.