diff --git a/pack-revindex.c b/pack-revindex.c index 83fe4de773..4262530449 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -253,7 +253,8 @@ cleanup: *data_p = (const uint32_t *)data; } - close(fd); + if (fd >= 0) + close(fd); return ret; }