[Rpm-maint] [rpm-software-management/rpm] Fix error message for rpmlock (#355), by removing dead code (#358)

Alan Jenkins notifications at github.com
Mon Nov 13 17:41:46 UTC 2017

(plus one bonus commit, hope that's ok)


rpmlock_acquire() failed to set errno, when it failed to acquire a
write-lock on a lock which was opened as read-only.  errno was printed in
the error message, so the error message was arbitrary.  Typically the
previous errno happened to be the right one, but if STDIN was not a TTY,
then it was not.  (Due to an intervening call to isatty()).

A one-line fix to set errno appropriately would not fix #355.  Because the
appropriate errno for performing write operations on a read-only handle
is EBADF.  This is too generic to tell the user what the real problem is
(i.e. that rpm was run without the necessary privilege to write to the lock

This obstacle would disappear if we could avoid the automatic fallback
from a read-write open() to a read-only open().  It turns out that
rpmlock.h never exported a read-only lock feature, so this was never used.

Remove the code for automatic fallback to read-only and read-only locks.
This makes #355 go away.
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * Fix error message for rpmlock (#355), by removing dead code
  * rpmlock_new(): use xcalloc()

-- File Changes --

    M lib/rpmlock.c (60)
    M lib/rpmlock.h (6)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20171113/6f83c4bc/attachment.html>

More information about the Rpm-maint mailing list