Path #defines are traditionally prefixed with _PATH.
authorflorian <florian@openbsd.org>
Sat, 27 Feb 2021 10:21:08 +0000 (10:21 +0000)
committerflorian <florian@openbsd.org>
Sat, 27 Feb 2021 10:21:08 +0000 (10:21 +0000)
pointed out by deraadt

sbin/dhcpleased/dhcpleased.c
sbin/dhcpleased/dhcpleased.h
usr.sbin/dhcpleasectl/dhcpleasectl.c

index ae0efe7..dca6461 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhcpleased.c,v 1.2 2021/02/27 10:07:41 florian Exp $  */
+/*     $OpenBSD: dhcpleased.c,v 1.3 2021/02/27 10:21:08 florian Exp $  */
 
 /*
  * Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -131,7 +131,7 @@ main(int argc, char *argv[])
        int                      pipe_main2engine[2];
        int                      frontend_routesock, rtfilter;
        int                      rtable_any = RTABLE_ANY;
-       char                    *csock = DHCPLEASED_SOCKET;
+       char                    *csock = _PATH_DHCPLEASED_SOCKET;
 #ifndef SMALL
        int                      control_fd;
 #endif /* SMALL */
@@ -267,7 +267,7 @@ main(int argc, char *argv[])
        if (unveil("/dev/bpf", "rw") == -1)
                fatal("unveil");
 
-       if (unveil(LEASE_PATH, "rwc") == -1)
+       if (unveil(_PATH_LEASE, "rwc") == -1)
                fatal("unveil");
 
        if (unveil(NULL, NULL) == -1)
@@ -621,9 +621,9 @@ configure_interface(struct imsg_configure_interface *imsg)
        char                    *if_name;
        char                     ntop_buf[INET_ADDRSTRLEN];
        char                     lease_buf[LEASE_SIZE];
-       char                     lease_file_buf[sizeof(LEASE_PATH) +
+       char                     lease_file_buf[sizeof(_PATH_LEASE) +
            IF_NAMESIZE];
-       char                     tmpl[] = LEASE_PATH"XXXXXXXXXX";
+       char                     tmpl[] = _PATH_LEASE"XXXXXXXXXX";
 
        log_debug("%s", __func__);
 
@@ -721,7 +721,7 @@ configure_interface(struct imsg_configure_interface *imsg)
        }
 
        len = snprintf(lease_file_buf, sizeof(lease_file_buf), "%s%s",
-           LEASE_PATH, if_name);
+           _PATH_LEASE, if_name);
        if ( len == -1 || (size_t) len >= sizeof(lease_file_buf)) {
                log_warnx("%s: failed to encode lease path for %s", __func__,
                    if_name);
@@ -960,7 +960,7 @@ read_lease_file(struct imsg_ifinfo *imsg_ifinfo)
 {
        int      len, fd;
        char     if_name[IF_NAMESIZE];
-       char     lease_file_buf[sizeof(LEASE_PATH) + IF_NAMESIZE];
+       char     lease_file_buf[sizeof(_PATH_LEASE) + IF_NAMESIZE];
 
        memset(imsg_ifinfo->lease, 0, sizeof(imsg_ifinfo->lease));
 
@@ -971,7 +971,7 @@ read_lease_file(struct imsg_ifinfo *imsg_ifinfo)
        }
 
        len = snprintf(lease_file_buf, sizeof(lease_file_buf), "%s%s",
-           LEASE_PATH, if_name);
+           _PATH_LEASE, if_name);
        if ( len == -1 || (size_t) len >= sizeof(lease_file_buf)) {
                log_warnx("%s: failed to encode lease path for %s", __func__,
                    if_name);
index a81dd18..b333127 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhcpleased.h,v 1.2 2021/02/27 10:07:41 florian Exp $  */
+/*     $OpenBSD: dhcpleased.h,v 1.3 2021/02/27 10:21:08 florian Exp $  */
 
 /*
  * Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define        DHCPLEASED_SOCKET       "/dev/dhcpleased.sock"
+#define        _PATH_DHCPLEASED_SOCKET "/dev/dhcpleased.sock"
 #define        DHCPLEASED_USER         "_dhcp"
 #define        DHCPLEASED_RTA_LABEL    "dhcpleased"
 #define        SERVER_PORT             67
 #define        CLIENT_PORT             68
-#define        LEASE_PATH              "/var/db/dhcpleased/"
+#define        _PATH_LEASE             "/var/db/dhcpleased/"
 #define        LEASE_PREFIX            "version: 1\nip: "
 #define        LEASE_SIZE              sizeof(LEASE_PREFIX"xxx.xxx.xxx.xxx\n")
 /* MAXDNAME from arpa/namesr.h */
index e05b70f..3bd1966 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhcpleasectl.c,v 1.1 2021/02/26 16:16:37 florian Exp $        */
+/*     $OpenBSD: dhcpleasectl.c,v 1.2 2021/02/27 10:21:08 florian Exp $        */
 
 /*
  * Copyright (c) 2021 Florian Obser <florian@openbsd.org>
@@ -74,7 +74,7 @@ main(int argc, char *argv[])
        int                      ch;
        char                    *sockname;
 
-       sockname = DHCPLEASED_SOCKET;
+       sockname = _PATH_DHCPLEASED_SOCKET;
        while ((ch = getopt(argc, argv, "s:")) != -1) {
                switch (ch) {
                case 's':