diff --git a/pack-mtimes.c b/pack-mtimes.c index 0e0aafdcb0..0f9785fc5e 100644 --- a/pack-mtimes.c +++ b/pack-mtimes.c @@ -89,7 +89,8 @@ static int load_pack_mtimes_file(char *mtimes_file, *data_p = data; } - close(fd); + if (fd >= 0) + close(fd); return ret; }