diff options
Diffstat (limited to 'freebsd/sbin/ifconfig/ifmac.c')
-rw-r--r-- | freebsd/sbin/ifconfig/ifmac.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/freebsd/sbin/ifconfig/ifmac.c b/freebsd/sbin/ifconfig/ifmac.c index a64a0cbf..b9aa5eed 100644 --- a/freebsd/sbin/ifconfig/ifmac.c +++ b/freebsd/sbin/ifconfig/ifmac.c @@ -1,5 +1,9 @@ #include <machine/rtems-bsd-user-space.h> +#ifdef __rtems__ +#include "rtems-bsd-ifconfig-namespace.h" +#endif /* __rtems__ */ + /*- * Copyright (c) 2001 Networks Associates Technology, Inc. * All rights reserved. @@ -36,6 +40,9 @@ * $FreeBSD$ */ +#ifdef __rtems__ +#include <machine/rtems-bsd-program.h> +#endif /* __rtems__ */ #include <rtems/bsd/sys/param.h> #include <sys/ioctl.h> #include <sys/mac.h> @@ -50,6 +57,9 @@ #include <string.h> #include "ifconfig.h" +#ifdef __rtems__ +#include "rtems-bsd-ifconfig-ifmac-data.h" +#endif /* __rtems__ */ static void maclabel_status(int s) @@ -59,7 +69,7 @@ maclabel_status(int s) char *label_text; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); if (mac_prepare_ifnet_label(&label) == -1) return; @@ -92,7 +102,7 @@ setifmaclabel(const char *val, int d, int s, const struct afswtch *rafp) } memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_ifru.ifru_data = (void *)label; error = ioctl(s, SIOCSIFMAC, &ifr); @@ -117,11 +127,9 @@ void #endif /* __rtems__ */ mac_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(mac_cmds); i++) + for (i = 0; i < nitems(mac_cmds); i++) cmd_register(&mac_cmds[i]); af_register(&af_mac); -#undef N } |