summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-11-26 03:56:25 -0800
committerVicent Martí <vicent@github.com>2012-11-26 03:56:25 -0800
commit8404f2d67f634dd4eb596c78691f8ef606d1e541 (patch)
tree7e3d08ca62e06c1be8337d6bbe4114129315aa18 /src
parent95cd83536fde09293a48f448cd26b88002d317cc (diff)
parentfcb48e068028da7b8cb60ac3954f3e9f5fc38390 (diff)
downloadlibgit2-8404f2d67f634dd4eb596c78691f8ef606d1e541.tar.gz
Merge pull request #1101 from csware/prevent_die
pack.c: Set p->mwf.fd to -1 on error
Diffstat (limited to 'src')
-rw-r--r--src/pack.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pack.c b/src/pack.c
index f08f3d8c4..a2a2fbcd1 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -564,8 +564,10 @@ static int packfile_open(struct git_pack_file *p)
/* TODO: open with noatime */
p->mwf.fd = git_futils_open_ro(p->pack_name);
- if (p->mwf.fd < 0)
- return p->mwf.fd;
+ if (p->mwf.fd < 0) {
+ p->mwf.fd = -1;
+ return -1;
+ }
if (p_fstat(p->mwf.fd, &st) < 0 ||
git_mwindow_file_register(&p->mwf) < 0)