Skip to content

Commit

Permalink
uds: Warn if replacing existing socket.
Browse files Browse the repository at this point in the history
When running multiple ptp4l instances, they need to be configured with
different UDS addresses in order for pmc/phc2sys to be able to
communicate with all instances. If this is not the case, the socket is
silently replaced in the order of started ptp4l instances and they
cannot be all reached over UDS.

Log a warning message if the socket is removed to make it more obvious
that something is wrong.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
  • Loading branch information
mlichvar authored and richardcochran committed Feb 28, 2024
1 parent 7996b9d commit accd35c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion uds.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ static int uds_open(struct transport *t, struct interface *iface, struct fdarray
sa.sun_family = AF_LOCAL;
strncpy(sa.sun_path, name, sizeof(sa.sun_path) - 1);

unlink(name);
if (!unlink(name))
pr_err("uds: removed existing %s", name);

err = bind(fd, (struct sockaddr *) &sa, sizeof(sa));
if (err < 0) {
Expand Down

0 comments on commit accd35c

Please sign in to comment.