Print this page
OS-3280 need a way to specify the root of a native system in the lx brand
OS-3279 lx brand should allow delegated datasets
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

@@ -35,21 +35,20 @@
  * University Acknowledgment- Portions of this document are derived from
  * software developed by the University of California, Berkeley, and its
  * contributors.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 /*LINTLIBRARY*/
 
 #include        <stdio.h>
 #include        <sys/types.h>
 #include        <fcntl.h>
 #include        <stdlib.h>
 #include        <string.h>
 #include        <unistd.h>
 #include        <errno.h>
+#include        <zone.h>
 #include        "curses_inc.h"
 
 #define TERMPATH        "/usr/share/lib/terminfo/"
 #define TERMPATHLEN     512
 

@@ -270,13 +269,15 @@
                 if ((tfd < 0) && (errno == EACCES))
                         goto cant_read;
         }
 
         if (tfd < 0) {
+                const char *zroot = zone_get_nroot();
                 /* /usr/share/lib/terminfo/?/$TERM */
                 if (snprintf(fname, sizeof (fname),
-                        "%s/%c/%s", TERMPATH, *term, term) >= sizeof (fname)) {
+                        "%s/%s/%c/%s", zroot == NULL ? "" : zroot, TERMPATH,
+                        *term, term) >= sizeof (fname)) {
                         term_errno = TERMINFO_TOO_LONG;
                         goto out_err;
                 }
 
                 tfd = open(fname, 0);