remember to close some files.... stupid stupid
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 15 Mar 1982 13:39:44 +0000 (05:39 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 15 Mar 1982 13:39:44 +0000 (05:39 -0800)
SCCS-vsn: local/sccscmds/sccscmds.2/util/curdir.c 4.3
SCCS-vsn: local/sccscmds/sccscmds.ok/util/curdir.c 4.3

usr/src/local/sccscmds/sccscmds.2/util/curdir.c
usr/src/local/sccscmds/sccscmds.ok/util/curdir.c

index 7102bbe..3d6e3de 100644 (file)
@@ -2,7 +2,7 @@
 # include      "dir.h"
 
 #define IROOT 2
 # include      "dir.h"
 
 #define IROOT 2
-SCCSID(@(#)curdir.c    4.2);
+SCCSID(@(#)curdir.c    4.3);
 /*
        current directory.
        Places the full pathname of the current directory in `str'.
 /*
        current directory.
        Places the full pathname of the current directory in `str'.
@@ -78,6 +78,7 @@ findir(flag)
                        close(fd);
                        return(0);
                }
                        close(fd);
                        return(0);
                }
+               close(fd);
                if ((fd = open("/etc/mtab", 0))<0) return(-1);
                while (read(fd,&mtab,64) == 64) {
                        char devstr[40];
                if ((fd = open("/etc/mtab", 0))<0) return(-1);
                while (read(fd,&mtab,64) == 64) {
                        char devstr[40];
@@ -89,6 +90,7 @@ findir(flag)
                        for (tp = mtab.m_dir; *curdirp = *tp++; curdirp++);
                        ADDSLASH;
                        *curdirp = 0;
                        for (tp = mtab.m_dir; *curdirp = *tp++; curdirp++);
                        ADDSLASH;
                        *curdirp = 0;
+                       close(fd);
                        return(0);
                }
                QUIT;
                        return(0);
                }
                QUIT;
index 7102bbe..3d6e3de 100644 (file)
@@ -2,7 +2,7 @@
 # include      "dir.h"
 
 #define IROOT 2
 # include      "dir.h"
 
 #define IROOT 2
-SCCSID(@(#)curdir.c    4.2);
+SCCSID(@(#)curdir.c    4.3);
 /*
        current directory.
        Places the full pathname of the current directory in `str'.
 /*
        current directory.
        Places the full pathname of the current directory in `str'.
@@ -78,6 +78,7 @@ findir(flag)
                        close(fd);
                        return(0);
                }
                        close(fd);
                        return(0);
                }
+               close(fd);
                if ((fd = open("/etc/mtab", 0))<0) return(-1);
                while (read(fd,&mtab,64) == 64) {
                        char devstr[40];
                if ((fd = open("/etc/mtab", 0))<0) return(-1);
                while (read(fd,&mtab,64) == 64) {
                        char devstr[40];
@@ -89,6 +90,7 @@ findir(flag)
                        for (tp = mtab.m_dir; *curdirp = *tp++; curdirp++);
                        ADDSLASH;
                        *curdirp = 0;
                        for (tp = mtab.m_dir; *curdirp = *tp++; curdirp++);
                        ADDSLASH;
                        *curdirp = 0;
+                       close(fd);
                        return(0);
                }
                QUIT;
                        return(0);
                }
                QUIT;