
1: GNU hello --- TODO 2: 3: Todo: 4: 5: * remove README-alpha from the distribution. 6: * submit a new hello.pot. 7: 8: -=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=- 9: 10: Subject: grep-2.0b: close stdout and make sure it succeeds 11: From: meyering@eng.ascend.com (Jim Meyering) 12: Date: 1997/07/16 13: Message-ID: <yzq4t9ucuz5.fsf@boom.eng.ascend.com> 14: Newsgroups: gnu.utils.bug 15: 16: 17: Hi Alain, 18: 19: Thanks for taking up the reins! 20: 21: Almost every program that writes a single byte to stdout should 22: do the following just before exiting: close stdout and give a 23: diagnostic if the close fails. 24: 25: Otherwise, write errors can go unreported. You can provoke this 26: by e.g. making grep generate lots of output and redirect that output 27: to a floppy or to any file system that's nearly full. 28: 29: GNU hello should set a good example and do this, too. 30: 31: Here's a patch I've been using for a long time: 32: 33: * src/grep.c: Cause grep to fail if `fclose (stdout)' fails. 34: 35: --- grep.c.orig Wed Jul 16 20:44:20 1997 36: +++ grep.c Wed Jul 16 20:44:30 1997 37: @@ -846,5 +846,8 @@ main(argc, argv) 38: printf(_("(standard input)\n")); 39: } 40: 41: + if (fclose (stdout) == EOF) 42: + error (_("writing output", errno)); 43: + 44: exit(errseen ? 2 : status); 45: } 46: 47: 48: end of file TODO