diff options
author | José Bollo <jose.bollo@iot.bzh> | 2018-06-22 18:24:46 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2018-06-22 18:24:46 +0200 |
commit | b474ee6a3905edba5d0aae1350ca2e58efa19622 (patch) | |
tree | 2d500a9c9ab52bb8172d5c17f7d31ca942734d2d | |
parent | 8ca7b69f3e3145f4c08bdbd278f200f6f8868d74 (diff) |
afb-autoset: Automatic prefix with unix:
Change-Id: I325d768b3bdfcb313b57e1752cbc156b3735b55a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-autoset.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/afb-autoset.c b/src/afb-autoset.c index b8f8a2ef..f43b011e 100644 --- a/src/afb-autoset.c +++ b/src/afb-autoset.c @@ -19,6 +19,8 @@ #include <stdlib.h> #include <stdint.h> +#include <stdio.h> +#include <limits.h> #include <string.h> #include <errno.h> #include <sys/types.h> @@ -113,6 +115,7 @@ static int create_any(const char *path, struct afb_apiset *declare_set, struct a { int rc; struct stat st; + char sockname[PATH_MAX + 7]; rc = stat(path, &st); if (!rc) { @@ -121,7 +124,8 @@ static int create_any(const char *path, struct afb_apiset *declare_set, struct a rc = afb_api_so_add_binding(path, declare_set, call_set); break; case S_IFSOCK: - rc = afb_api_ws_add_client(path, declare_set, call_set, 0); + snprintf(sockname, sizeof sockname, "unix:%s", path); + rc = afb_api_ws_add_client(sockname, declare_set, call_set, 0); break; default: NOTICE("Unexpected autoset entry: %s", path); |