summaryrefslogtreecommitdiff
path: root/backport-treat-0-as-valid-file-descriptor.patch
blob: 154e55adaf241b69e386e916f1091971d36f29db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From be64821b908fdb1ff3c12530430d1cf046839e60 Mon Sep 17 00:00:00 2001
From: licunlong <licunlong1@huawei.com>
Date: Thu, 20 Jan 2022 19:59:44 +0800
Subject: [PATCH] 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.

---
 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 64d0493..0a041e4 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;
-- 
1.8.3.1