From b0a589b792be4eeb274ff64e52108aed0731d805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Wed, 14 Mar 2018 07:06:25 +0000 Subject: [PATCH] Use GT_RUNDIR for local sockets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- src/bind.c | 2 +- src/common.h | 4 ++++ src/path.c | 2 +- src/set.c | 2 +- src/show.c | 4 ++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bind.c b/src/bind.c index 4c568dd..43b8c59 100644 --- a/src/bind.c +++ b/src/bind.c @@ -192,7 +192,7 @@ gt_bind(int argc, char **argv) } } - int ctl_fd = ctl_create("/run/" PACKAGE_NAME, tun_name); + int ctl_fd = ctl_create(GT_RUNDIR, tun_name); if (ctl_fd == -1) { perror("ctl_create"); diff --git a/src/common.h b/src/common.h index 01bcca0..25b4b33 100644 --- a/src/common.h +++ b/src/common.h @@ -21,6 +21,10 @@ #define PACKAGE_VERSION "0.0.0" #endif +#ifndef GT_RUNDIR +#define GT_RUNDIR "/run/" PACKAGE_NAME +#endif + #define COUNT(x) (sizeof(x)/sizeof(x[0])) #define ALIGN_SIZE (1<<4) diff --git a/src/path.c b/src/path.c index eed3120..902b8ab 100644 --- a/src/path.c +++ b/src/path.c @@ -83,7 +83,7 @@ gt_path(int argc, char **argv) if (argz(pathz, argc, argv)) return 1; - int fd = ctl_connect("/run/" PACKAGE_NAME, dev); + int fd = ctl_connect(GT_RUNDIR, dev); if (fd == -1) { perror("path"); diff --git a/src/set.c b/src/set.c index b83a1e3..ae00586 100644 --- a/src/set.c +++ b/src/set.c @@ -127,7 +127,7 @@ gt_set(int argc, char **argv) if (argz(pathz, argc, argv)) return 1; - int fd = ctl_connect("/run/" PACKAGE_NAME, dev); + int fd = ctl_connect(GT_RUNDIR, dev); if (fd == -1) { perror("set"); diff --git a/src/show.c b/src/show.c index cb843f7..5cd3422 100644 --- a/src/show.c +++ b/src/show.c @@ -56,7 +56,7 @@ gt_show_dev_status(int fd, const char *dev) static int gt_show_dev(const char *dev) { - int fd = ctl_connect("/run/" PACKAGE_NAME, dev); + int fd = ctl_connect(GT_RUNDIR, dev); if (fd == -1) { perror(dev); @@ -93,7 +93,7 @@ gt_show(int argc, char **argv) return 0; } - DIR *dp = opendir("/run/" PACKAGE_NAME); + DIR *dp = opendir(GT_RUNDIR); if (!dp) { if (errno == ENOENT)