summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlicunlong <licunlong1@huawei.com>2022-01-20 19:59:44 +0800
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commit29573b65858422686da4834a1632a4c6cc5f9c61 (patch)
tree3ca91c9fb53bcf1c6e96adc10f87ecadb035d38c
parent42fae2fa5bce5bf1ef5685619fa8d62a746c9dbd (diff)
downloadrpm-29573b65858422686da4834a1632a4c6cc5f9c61.tar.gz
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)
-rw-r--r--lib/backend/ndb/rpmpkg.c2
1 files changed, 1 insertions, 1 deletions
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;