Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC830919); site kvvax4.UUCP
Path: utzoo!linus!decvax!mcvax!kvport!kvvax4!pete
From: pete@kvvax4.UUCP (Pete Story)
Newsgroups: net.bugs.4bsd
Subject: bug in error(1)
Message-ID: <300@kvvax4.UUCP>
Date: Sun, 4-Jan-70 04:59:59 EST
Article-I.D.: kvvax4.300
Posted: Sun Jan  4 04:59:59 1970
Date-Received: Sun, 12-Feb-84 21:56:39 EST
Organization: Kongsberg Vaapenfabrikk, CTG, P.O Box 25, N-3601 Kongsberg, Norway
Lines: 24



If you use error(1) to put error messages back into source files, and you
happen to get a full file system or other write errors, you are going
to lose your source.  Here is a fix, with no guarantees (my file system
isn't full any more, so I can't test it).

1a2,6
> /* KV id    : @(#)errortouch.c	1.2
> * modified  : Fri Feb 10 15:30:45 GMT+1:00 1984, by pete
> *    to check the return codes from fwrite and avoid losing sources on
> *    full file systems, etc
> */
385c390,394
< 		fwrite(edbuffer, 1, bytes_read, n_touchedfile);
---
> 	   if (fwrite(edbuffer, 1, bytes_read, n_touchedfile) != bytes_read) {
> 	      fprintf(stderr,"%s: write error in touching, no change made\n",
> 		 processname);
> 	      return(-1);
> 	   }
-- 
Pete Story {decvax,philabs}!mcvax!kvport!kvvax4!pete
A/S Kongsberg Vaapenfabrikk, PO Box 25, N3601 Kongsberg, Norway