MCPcopy Create free account
hub / github.com/coreutils/coreutils / xfclose

Function xfclose

src/sort.c:1037–1058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1035/* Close FP, whose name is FILE, and report any errors. */
1036
1037static void
1038xfclose (FILE *fp, char const *file)
1039{
1040 switch (fileno (fp))
1041 {
1042 case STDIN_FILENO:
1043 /* Allow reading stdin from tty more than once. */
1044 clearerr (fp);
1045 break;
1046
1047 case STDOUT_FILENO:
1048 /* Don't close stdout just yet. close_stdout does that. */
1049 if (fflush (fp) != 0)
1050 sort_die (_("fflush failed"), file);
1051 break;
1052
1053 default:
1054 if (fclose (fp) != 0)
1055 sort_die (_("close failed"), file);
1056 break;
1057 }
1058}
1059
1060/* Move OLDFD to NEWFD. If OLDFD != NEWFD, NEWFD is not close-on-exec. */
1061

Callers 5

checkFunction · 0.85
mergefpsFunction · 0.85
mergeFunction · 0.85
sortFunction · 0.85
mainFunction · 0.85

Calls 1

sort_dieFunction · 0.85

Tested by

no test coverage detected