Skip to content

Commit

Permalink
Use SNAP_COMMON for domain socket, too (Issue #128, Issue #148)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Apr 16, 2021
1 parent 0a37fab commit eeb0991
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pappl/mainloop-support.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ _papplMainloopGetServerPath(
char *buffer, // I - Buffer for filename
size_t bufsize) // I - Size of buffer
{
const char *snap_common; // SNAP_COMMON environment variable


if (uid)
{
// Per-user server...
Expand All @@ -477,6 +480,11 @@ _papplMainloopGetServerPath(

snprintf(buffer, bufsize, "%s/%s%d.sock", tmpdir, base_name, (int)uid);
}
else if ((snap_common = getenv("SNAP_COMMON")) != NULL)
{
// System server running as root inside a snap (https://snapcraft.io)...
snprintf(buffer, bufsize, "%s/%s.sock", snap_common, base_name);
}
else
{
// System server running as root
Expand Down

0 comments on commit eeb0991

Please sign in to comment.