summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-03-06 13:07:55 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-03-06 13:07:55 +0100
commit68a83a64cd424385b613f58e23c03e262d840b91 (patch)
treeedcea4a983e0333d98e5a837652702202d6e6585 /apt-pkg
parent9f36e3cf3fe158fd52c662b5c8c6f6cab327fa06 (diff)
GetLock: No strerror if it's just another process holding the lock
This improves the locking message, getting rid of useless details. If we have a process holding the lock, we got that because the lock is being hold by it, so there's no point telling the people the reason for not getting the lock is the EAGAIN error and displaying its strerrror().
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/fileutl.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index db5463be2..045dbe17d 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -302,13 +302,15 @@ int GetLock(string File,bool Errors)
if (Errors == true)
{
+ // We only do the lookup in the if ((errno == EACCES || errno == EAGAIN))
+ // case, so we do not need to show the errno strerrr here...
if (fl.l_pid != -1)
{
auto name = GetProcessName(fl.l_pid);
if (name.empty())
- _error->Errno("open", _("Could not get lock %s. It is held by process %d"), File.c_str(), fl.l_pid);
+ _error->Error(_("Could not get lock %s. It is held by process %d"), File.c_str(), fl.l_pid);
else
- _error->Errno("open", _("Could not get lock %s. It is held by process %d (%s)"), File.c_str(), fl.l_pid, name.c_str());
+ _error->Error(_("Could not get lock %s. It is held by process %d (%s)"), File.c_str(), fl.l_pid, name.c_str());
}
else
_error->Errno("open", _("Could not get lock %s"), File.c_str());