comparison lib/xwrap.c @ 1644:492bd41f8b9a draft

Move fflush() checking to xexit() and have exit paths in main() call that.
author Rob Landley <rob@landley.net>
date Sat, 03 Jan 2015 16:25:36 -0600
parents ce22ad7a26c1
children 10922d83392a
comparison
equal deleted inserted replaced
1643:54c092c3ee38 1644:492bd41f8b9a
28 strcpy(dest+len, src); 28 strcpy(dest+len, src);
29 } 29 }
30 30
31 void xexit(void) 31 void xexit(void)
32 { 32 {
33 if (fflush(NULL) || ferror(stdout))
34 if (!toys.exitval) perror_msg("write");
33 if (toys.rebound) longjmp(*toys.rebound, 1); 35 if (toys.rebound) longjmp(*toys.rebound, 1);
34 else exit(toys.exitval); 36 else exit(toys.exitval);
35 } 37 }
36 38
37 // Die unless we can allocate memory. 39 // Die unless we can allocate memory.