Skip to content

Commit

Permalink
polkit-agent: Don't print a warning if not installed
Browse files Browse the repository at this point in the history
We don't want to have a hard dependency on polkit.  Some read-only DBus
APIs (e.g. `rpm-ostree status`) can be invoked unprivileged.

xref https://bugzilla.redhat.com/show_bug.cgi?id=2105405
  • Loading branch information
cgwalters committed Jul 27, 2022
1 parent 7a29de1 commit 6698a8c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/rpmostree-polkit-agent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <string.h>
#include <sys/poll.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
Expand Down Expand Up @@ -215,6 +216,17 @@ rpmostree_polkit_agent_open (void)
if (!isatty (STDIN_FILENO))
return 0;

/* Don't print an error if there's no pkttyagent; we don't want
* to have a hard dependency on it. Not all DBus methods require
* it.
*/
struct stat stbuf;
if (stat (POLKIT_TTY_AGENT_BINARY_PATH, &stbuf) < 0)
{
if (errno == ENOENT)
return 0;
}

if (pipe (pipe_fd) < 0)
return -errno;

Expand Down

0 comments on commit 6698a8c

Please sign in to comment.