[SAP] disable sap socket if it does not exist, otherwise it interrupts normal SIM operations

This commit is contained in:
Nico Golde 2012-06-18 11:56:55 +02:00
parent 8cbbb75bf5
commit 8497747c72
1 changed files with 2 additions and 0 deletions

View File

@ -498,6 +498,7 @@ int sap_open(struct osmocom_ms *ms, const char *socket_path)
{
ssize_t rc;
struct sockaddr_un local;
struct gsm_settings *set = &ms->settings;
ms->sap_wq.bfd.fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (ms->sap_wq.bfd.fd < 0) {
@ -512,6 +513,7 @@ int sap_open(struct osmocom_ms *ms, const char *socket_path)
rc = connect(ms->sap_wq.bfd.fd, (struct sockaddr *) &local, sizeof(local));
if (rc < 0) {
fprintf(stderr, "Failed to connect to '%s'\n", local.sun_path);
set->sap_socket_path[0] = 0;
close(ms->sap_wq.bfd.fd);
return rc;
}