summaryrefslogtreecommitdiff
path: root/usr/src/lib/libnsl/netselect/netselect.c
diff options
context:
space:
mode:
authorJoshua M. Clulow <jmc@joyent.com>2015-06-02 23:07:51 +0000
committerJoshua M. Clulow <jmc@joyent.com>2015-06-08 20:46:22 +0000
commitca25e811fab6e9a46554bf5a8f0604786416249a (patch)
tree2e83659d261473358f5feb09005e1dca46bdd095 /usr/src/lib/libnsl/netselect/netselect.c
parent5051b3d9301ef2c6c983bd89bb85606e19723a4d (diff)
downloadillumos-joyent-ca25e811fab6e9a46554bf5a8f0604786416249a.tar.gz
OS-4348 libnsl should seek netconfig file in native root
Reviewed by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/libnsl/netselect/netselect.c')
-rw-r--r--usr/src/lib/libnsl/netselect/netselect.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr/src/lib/libnsl/netselect/netselect.c b/usr/src/lib/libnsl/netselect/netselect.c
index fe8611fd13..8c21fc3d69 100644
--- a/usr/src/lib/libnsl/netselect/netselect.c
+++ b/usr/src/lib/libnsl/netselect/netselect.c
@@ -44,6 +44,7 @@
#include <malloc.h>
#include <libintl.h>
#include <syslog.h>
+#include <zone.h>
#include "netcspace.h"
#define FAILURE (unsigned)(-1)
@@ -279,13 +280,22 @@ getnetlist(void)
struct netconfig **listpp; /* the beginning of the netconfig list */
struct netconfig **tpp; /* used to traverse the netconfig list */
int count; /* the number of entries in file */
+ char nc_path[MAXPATHLEN];
+ const char *zroot = zone_get_nroot();
+
+ /*
+ * If we are running in a branded zone, ensure we use the "/native"
+ * prefix when opening the netconfig file:
+ */
+ (void) snprintf(nc_path, sizeof (nc_path), "%s%s", zroot != NULL ?
+ zroot : "", NETCONFIG);
if (brand_get_sz != NULL) {
count = brand_get_sz();
} else {
char line[BUFSIZ]; /* holds each line of NETCONFIG */
- if ((fp = fopen(NETCONFIG, "rF")) == NULL) {
+ if ((fp = fopen(nc_path, "rF")) == NULL) {
nc_error = NC_OPENFAIL;
return (NULL);
}