aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bsc_rf_ctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bsc/bsc_rf_ctrl.c')
-rw-r--r--src/osmo-bsc/bsc_rf_ctrl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/osmo-bsc/bsc_rf_ctrl.c b/src/osmo-bsc/bsc_rf_ctrl.c
index ac87fb93d..791abf6cb 100644
--- a/src/osmo-bsc/bsc_rf_ctrl.c
+++ b/src/osmo-bsc/bsc_rf_ctrl.c
@@ -450,12 +450,16 @@ static int rf_create_socket(struct osmo_bsc_rf *rf, const char *path)
}
local.sun_family = AF_UNIX;
- unlink(local.sun_path);
if (osmo_strlcpy(local.sun_path, path, sizeof(local.sun_path)) >= sizeof(local.sun_path)) {
LOGP(DLINP, LOGL_ERROR, "Socket path exceeds maximum length of %zd bytes: %s\n",
sizeof(local.sun_path), path);
return -1;
}
+ if (unlink(local.sun_path) < 0 && errno != ENOENT) {
+ LOGP(DLINP, LOGL_ERROR, "Could not unlink socket path %s: %d/%s\n",
+ path, errno, strerror(errno));
+ return -1;
+ }
/* we use the same magic that X11 uses in Xtranssock.c for
* calculating the proper length of the sockaddr */