Skip to content

Commit

Permalink
Use relative symlinks
Browse files Browse the repository at this point in the history
Absolute symlinks are typically discouraged, as they are confusing in
chroot environments.  This is not a problem here, but there is also no
reason to use an absolute symlink as a relative symlink does the job
just as well.
  • Loading branch information
DemiMarie committed Apr 11, 2024
1 parent d8881ca commit cb99ff1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions daemon/qrexec-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,12 @@ static int create_qrexec_socket(int domid, const char *domname)
res = unlink(link_to_socket_name);
if (res != 0 && !(res == -1 && errno == ENOENT))
err(1, "unlink(%s)", link_to_socket_name);
const char *symlink_target = socket_address + strlen(socket_dir) + 1;

/* When running as root, make the socket accessible; perms on /var/run/qubes still apply */
umask(0);
if (symlink(socket_address, link_to_socket_name)) {
PERROR("symlink(%s,%s)", socket_address, link_to_socket_name);
if (symlink(symlink_target, link_to_socket_name)) {
PERROR("symlink(%s,%s)", symlink_target, link_to_socket_name);
}
int fd = get_server_socket(socket_address);
umask(0077);
Expand Down

0 comments on commit cb99ff1

Please sign in to comment.