From 29573b65858422686da4834a1632a4c6cc5f9c61 Mon Sep 17 00:00:00 2001 From: licunlong Date: Thu, 20 Jan 2022 19:59:44 +0800 Subject: treat 0 as valid file descriptor The descriptor is openned in rpmpkgOpen, and we treat 0 as valid file descriptor. Here we should do the same or fail earlier. (cherry picked from commit be64821b908fdb1ff3c12530430d1cf046839e60) --- lib/backend/ndb/rpmpkg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/backend/ndb/rpmpkg.c b/lib/backend/ndb/rpmpkg.c index 64d049350..0a041e4c0 100644 --- a/lib/backend/ndb/rpmpkg.c +++ b/lib/backend/ndb/rpmpkg.c @@ -734,7 +734,7 @@ static int rpmpkgAddSlotPage(rpmpkgdb pkgdb) static int rpmpkgGetLock(rpmpkgdb pkgdb, int type) { - if (!pkgdb->fd) + if (pkgdb->fd < 0) return RPMRC_FAIL; if (flock(pkgdb->fd, type)) return RPMRC_FAIL; -- cgit v1.2.1