Subject: Re: kern/30: fsync on pipe fails
To: None <cgd@nobozo.CS.Berkeley.EDU>
From: Bill Sommerfeld <sommerfeld@orchard.medford.ma.us>
List: netbsd-bugs
Date: 11/30/1993 10:53:58
   umm, as far as i can tell, every UN*X that i have access to (net/2
   derivatives, 4.4BSD, Ultrix, SunOS, Domain/OS) does exactly this.
   it's the expected behaviour, not a bug.  RCS is in error here, and the
   vfs routines should not be "fixed."

Err.  "Never Mind".

Apply the following patch to gnu/usr.bin/rcs/lib/rcslex.c instead:

*** 1.1	1993/11/30 15:48:37
--- 1.2	1993/11/30 15:50:54
***************
*** 855,862 ****
  #ifndef FSYNC_ALL
  void Ofclose(f) FILE *f; { if (f && fclose(f)!=0) Oerror(); }
  #else
  void Ofclose(f) FILE *f; { if (f && (fflush(f)!=0 ||
! 				     fsync(fileno(f))!=0 ||
  				     fclose(f)!=0)) Oerror(); }
  #endif
  void Izclose(p) RILE **p; { Ifclose(*p); *p = 0; }
--- 855,866 ----
  #ifndef FSYNC_ALL
  void Ofclose(f) FILE *f; { if (f && fclose(f)!=0) Oerror(); }
  #else
+ int rcsfsync(fd) int fd; { int ret = fsync(fd);
+ 			   if ((ret < 0) && (errno == EINVAL))
+ 				   return 0;
+ 			   else return ret; }
  void Ofclose(f) FILE *f; { if (f && (fflush(f)!=0 ||
! 				     rcsfsync(fileno(f))!=0 ||
  				     fclose(f)!=0)) Oerror(); }
  #endif
  void Izclose(p) RILE **p; { Ifclose(*p); *p = 0; }


------------------------------------------------------------------------------