From 493812ee6e03bbcf87c1e64b66108fc5a1e1e399 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Wed, 9 Feb 2011 08:01:10 +0000 Subject: [PATCH] When we decide to unlink socket file, sun_path must be set. If it is set, but there is problem unlinking the file, log a warning. MFC after: 1 week --- sbin/hastd/proto_uds.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;