diff --git a/sbin/hastd/proto_uds.c b/sbin/hastd/proto_uds.c index 13292c0ebb31..8429d85233b3 100644 --- a/sbin/hastd/proto_uds.c +++ b/sbin/hastd/proto_uds.c @@ -319,7 +319,12 @@ uds_close(void *ctx) */ if (uctx->uc_side == UDS_SIDE_SERVER_LISTEN && uctx->uc_owner == getpid()) { - (void)unlink(uctx->uc_sun.sun_path); + PJDLOG_ASSERT(uctx->uc_sun.sun_path[0] != '\0'); + if (unlink(uctx->uc_sun.sun_path) == -1) { + pjdlog_errno(LOG_WARNING, + "Unable to unlink socket file %s", + uctx->uc_sun.sun_path); + } } uctx->uc_owner = 0; uctx->uc_magic = 0;