From 32ac3f845f99de2c07c218ed42f85df7118021ae Mon Sep 17 00:00:00 2001 From: pjd Date: Wed, 9 Feb 2011 08:01:10 +0000 Subject: 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(-) (limited to 'sbin/hastd/proto_uds.c') diff --git a/sbin/hastd/proto_uds.c b/sbin/hastd/proto_uds.c index 13292c0..8429d85 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; -- cgit v1.1