2019-09-30 11:16:24 -04:00
|
|
|
From c6699a7e90acfaa421830ce0fc12940335e40d7b Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: shanshishi <shanshishi@huawei.com>
|
|
|
|
|
Date: Sun, 19 May 2019 16:49:45 +0800
|
|
|
|
|
Subject: [PATCH] rpm: wait once get rpmlock fail
|
|
|
|
|
|
|
|
|
|
reason: When executing the rpm command concurrently, it will block some
|
|
|
|
|
times, because of lock is applied before.
|
|
|
|
|
|
|
|
|
|
Signed-off-by: shanshishi <shanshishi@huawei.com>
|
|
|
|
|
---
|
|
|
|
|
lib/rpmlock.c | 5 +----
|
|
|
|
|
1 file changed, 1 insertion(+), 4 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/rpmlock.c b/lib/rpmlock.c
|
2022-10-27 02:00:37 +00:00
|
|
|
index d693c4b..86e07b3 100644
|
2019-09-30 11:16:24 -04:00
|
|
|
--- a/lib/rpmlock.c
|
|
|
|
|
+++ b/lib/rpmlock.c
|
2022-10-27 02:00:37 +00:00
|
|
|
@@ -125,13 +125,10 @@ rpmlock rpmlockNew(const char *lock_path, const char *descr)
|
2019-09-30 11:16:24 -04:00
|
|
|
int rpmlockAcquire(rpmlock lock)
|
|
|
|
|
{
|
|
|
|
|
int locked = 0; /* assume failure */
|
|
|
|
|
- int myerrno = errno;
|
|
|
|
|
- int maywait = isatty(STDIN_FILENO); /* dont wait within scriptlets */
|
|
|
|
|
- errno = myerrno;
|
|
|
|
|
|
|
|
|
|
if (lock) {
|
|
|
|
|
locked = rpmlock_acquire(lock, RPMLOCK_WRITE);
|
|
|
|
|
- if (!locked && (lock->openmode & RPMLOCK_WRITE) && maywait) {
|
|
|
|
|
+ if (!locked && (lock->openmode & RPMLOCK_WRITE)) {
|
|
|
|
|
rpmlog(RPMLOG_WARNING, _("waiting for %s lock on %s\n"),
|
|
|
|
|
lock->descr, lock->path);
|
|
|
|
|
locked = rpmlock_acquire(lock, (RPMLOCK_WRITE|RPMLOCK_WAIT));
|
|
|
|
|
--
|
2022-10-27 02:00:37 +00:00
|
|
|
1.7.12.4
|
2019-09-30 11:16:24 -04:00
|
|
|
|