]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
close a filehandle before opening.
authorneilbrown <neilbrown>
Mon, 11 Aug 2003 05:55:49 +0000 (05:55 +0000)
committerneilbrown <neilbrown>
Mon, 11 Aug 2003 05:55:49 +0000 (05:55 +0000)
ChangeLog
utils/mountd/cache.c

index 81ccf88bc851d8f9e51c1175a44ff5fafcc0ea89..ec81bb5dd6efd78a48902f20c5cc974c30cd9b0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-08-11 NeilBrown <neilb@cse.unsw.edu.au>
+       * utils/mountd/cache.c(cache_get_filehandle): close the filehandle
+       before returning.
+       
 2003-08-04 NeilBrown <neilb@cse.unsw.edu.au>
        * support/include/nfs/export.h, support/nfs/exports.c,
        utils/exportfs/exports.c, utils/mountd/mountd.c:  change
index 96492b8f5b467ec55ddc408eeb798339a8ce47f0..a265ecda9f6412fefa457b79a915f32cfa0506c9 100644 (file)
@@ -376,6 +376,7 @@ cache_get_filehandle(nfs_export *exp, int len, char *p)
        FILE *f = fopen("/proc/fs/nfsd/filehandle", "r+");
        char buf[200];
        char *bp = buf;
+       int failed;
        static struct nfs_fh_len fh;
 
        if (!f)
@@ -388,7 +389,9 @@ cache_get_filehandle(nfs_export *exp, int len, char *p)
        qword_printint(f, len); 
        qword_eol(f);
        
-       if (fgets(buf, sizeof(buf), f) == NULL)
+       failed = (fgets(buf, sizeof(buf), f) == NULL);
+       fclose(f);
+       if (failed)
                return NULL;
        memset(fh.fh_handle, 0, sizeof(fh.fh_handle));
        fh.fh_size = qword_get(&bp, fh.fh_handle, NFS3_FHSIZE);