author | Alberto Bertogli
<albertito@gmail.com> 2004-08-30 04:30:41 UTC |
committer | Alberto Bertogli
<albertito@gmail.com> 2007-07-15 13:17:52 UTC |
parent | 8bec7feb396189a48ff624b56e64a8b43fba0aff |
trans.c | +6 | -3 |
diff --git a/trans.c b/trans.c index 03604eb..438a53c 100644 --- a/trans.c +++ b/trans.c @@ -598,6 +598,9 @@ int jsync(struct jfs *fs) int rv; struct jlinger *linger, *ltmp; + if (fs->fd < 0) + return -1; + rv = fsync(fs->fd); if (rv != 0) return rv; @@ -628,11 +631,11 @@ int jclose(struct jfs *fs) if (jsync(fs)) ret = -1; - if (close(fs->fd)) + if (fs->fd < 0 || close(fs->fd)) ret = -1; - if (close(fs->jfd)) + if (fs->jfd < 0 || close(fs->jfd)) ret = -1; - if (close(fs->jdirfd)) + if (fs->jdirfd < 0 || close(fs->jdirfd)) ret = -1; if (fs->name) /* allocated by strdup() in jopen() */