diff options
author | Sven Strickroth <email@cs-ware.de> | 2013-07-25 14:54:19 +0200 |
---|---|---|
committer | Sven Strickroth <email@cs-ware.de> | 2013-07-25 15:21:55 +0200 |
commit | 3a2d48d5ee48c520fdc6b0cd65e1982db7751352 (patch) | |
tree | 59d49c12c94e6ca35609b32742fd721710d242dc /src | |
parent | cdbcb8dd80ccae119ab56daa6da51990667e653c (diff) | |
download | libgit2-3a2d48d5ee48c520fdc6b0cd65e1982db7751352.tar.gz |
Close p->mwf.fd only if necessary
This fixes a regression introduced in revision 9d2f841a5d39fc25ce722a3904f6ebc9aa112222.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/pack.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pack.c b/src/pack.c index 497db38e8..d7e6a1e94 100644 --- a/src/pack.c +++ b/src/pack.c @@ -822,7 +822,7 @@ void git_packfile_free(struct git_pack_file *p) git_mwindow_free_all(&p->mwf); - if (p->mwf.fd != -1) + if (p->mwf.fd >= 0) p_close(p->mwf.fd); pack_index_free(p); @@ -905,7 +905,8 @@ static int packfile_open(struct git_pack_file *p) cleanup: giterr_set(GITERR_OS, "Invalid packfile '%s'", p->pack_name); - p_close(p->mwf.fd); + if (p->mwf.fd >= 0) + p_close(p->mwf.fd); p->mwf.fd = -1; git_mutex_unlock(&p->lock); |