check sync_fp before calling fclose().
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Wed, 2 Nov 1983 09:32:29 +0000 (01:32 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Wed, 2 Nov 1983 09:32:29 +0000 (01:32 -0800)
SCCS-vsn: games/sail/sync.c 2.2

usr/src/games/sail/sync.c

index 1095cd4..3cde4d1 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)sync.c      2.1 83/10/31";
+static char *sccsid = "@(#)sync.c      2.2 83/11/01";
 #endif
 
 #include "externs.h"
 #endif
 
 #include "externs.h"
@@ -73,7 +73,8 @@ sync_open()
 sync_close(remove)
 char remove;
 {
 sync_close(remove)
 char remove;
 {
-       (void) fclose(sync_fp);
+       if (sync_fp != 0)
+               (void) fclose(sync_fp);
        if (remove)
                (void) unlink(sync_file);
 }
        if (remove)
                (void) unlink(sync_file);
 }