From 967cd26f61253c4030310cf60bf01fb350dfe628 Mon Sep 17 00:00:00 2001 From: Nate Williams Date: Mon, 28 Jun 1993 19:13:10 +0000 Subject: [PATCH] Added Chris Demetriou's FSYNC_ALL option which causes all writes to be flushed immediately. (In case of a crash in the middle of CVS/RCS commits --- gnu/usr.bin/rcs/lib/Makefile | 11 ++++++++--- gnu/usr.bin/rcs/lib/rcslex.c | 11 ++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gnu/usr.bin/rcs/lib/Makefile b/gnu/usr.bin/rcs/lib/Makefile index b198e9ec6f98..f0d472576e9e 100644 --- a/gnu/usr.bin/rcs/lib/Makefile +++ b/gnu/usr.bin/rcs/lib/Makefile @@ -1,5 +1,10 @@ -LIB= rcs -SRCS= maketime.c partime.c rcsedit.c rcsfcmp.c rcsfnms.c rcsgen.c rcskeep.c \ - rcskeys.c rcslex.c rcsmap.c rcsrev.c rcssyn.c rcsutil.c merger.c +# Define FSYNC_ALL to get slower but safer writes in case of crashes in +# the middle of CVS/RCS changes +CFLAGS += -DFSYNC_ALL + +LIB = rcs +SRCS = maketime.c partime.c rcsedit.c rcsfcmp.c rcsfnms.c rcsgen.c \ + rcskeep.c rcskeys.c rcslex.c rcsmap.c rcsrev.c rcssyn.c rcsutil.c \ + merger.c .include diff --git a/gnu/usr.bin/rcs/lib/rcslex.c b/gnu/usr.bin/rcs/lib/rcslex.c index 51e31f3445c1..cedbc402f2b7 100644 --- a/gnu/usr.bin/rcs/lib/rcslex.c +++ b/gnu/usr.bin/rcs/lib/rcslex.c @@ -39,6 +39,9 @@ Report problems and direct all questions to: /* $Log: rcslex.c,v $ + * Revision 1.1.1.1 1993/06/18 04:22:12 jkh + * Updated GNU utilities + * * Revision 5.11 1991/11/03 03:30:44 eggert * Fix porting bug to ancient hosts lacking vfprintf. * @@ -132,7 +135,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(lexId, "$Id: rcslex.c,v 5.11 1991/11/03 03:30:44 eggert Exp $") +libId(lexId, "$Id: rcslex.c,v 1.1.1.1 1993/06/18 04:22:12 jkh Exp $") static struct hshentry *nexthsh; /*pointer to next hash entry, set by lookup*/ @@ -935,7 +938,13 @@ void testIerror(f) FILE *f; { if (ferror(f)) Ierror(); } void testOerror(o) FILE *o; { if (ferror(o)) Oerror(); } void Ifclose(f) RILE *f; { if (f && Iclose(f)!=0) Ierror(); } +#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; } void Ozclose(p) FILE **p; { Ofclose(*p); *p = 0; }