[net.bugs.4bsd] bug in error

pete@kvvax4.UUCP (Pete Story) (01/04/70)

<for mailers?>

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