add some paranoia -- fo can be null if errors occur
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 1 Oct 1987 08:19:40 +0000 (00:19 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 1 Oct 1987 08:19:40 +0000 (00:19 -0800)
SCCS-vsn: old/refer/refer/refer7.c 4.4

usr/src/old/refer/refer/refer7.c

index c285da3..858e7e3 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)refer7.c    4.3 (Berkeley) %G%";
+static char *sccsid = "@(#)refer7.c    4.4 (Berkeley) %G%";
 #endif
 
 #include "refer..c"
 #endif
 
 #include "refer..c"
@@ -32,8 +32,10 @@ dumpold()
 
        if (!endpush)
                return;
 
        if (!endpush)
                return;
-       fclose(fo);
-       fo = NULL;
+       if (fo != NULL) {
+               fclose(fo);
+               fo = NULL;
+       }
        if (sort) {
                char comm[100];
                sprintf(comm, "sort -f %s -o %s", tfile, tfile);
        if (sort) {
                char comm[100];
                sprintf(comm, "sort -f %s -o %s", tfile, tfile);