diff options
author | rab <none@none> | 2006-09-28 11:08:50 -0700 |
---|---|---|
committer | rab <none@none> | 2006-09-28 11:08:50 -0700 |
commit | c6e808750ddfd0119ee0388c350ebcaf7d4027b7 (patch) | |
tree | 11f044960f0660bfac06fbb9b429588e1fd0eb14 /usr/src/lib/libproc/common/Pexecname.c | |
parent | 48a344074403d73a2e38d76ad47299c16c89e0dc (diff) | |
download | illumos-joyent-c6e808750ddfd0119ee0388c350ebcaf7d4027b7.tar.gz |
6469953 BrandZ makes libproc (in /lib) depend on libzonecfg (in /usr/lib)
6475890 Pfindexec() search could use improvement
Diffstat (limited to 'usr/src/lib/libproc/common/Pexecname.c')
-rw-r--r-- | usr/src/lib/libproc/common/Pexecname.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/usr/src/lib/libproc/common/Pexecname.c b/usr/src/lib/libproc/common/Pexecname.c index a2c2ccf574..d240c9b427 100644 --- a/usr/src/lib/libproc/common/Pexecname.c +++ b/usr/src/lib/libproc/common/Pexecname.c @@ -34,7 +34,7 @@ #include <stdio.h> #include <errno.h> #include <unistd.h> -#include <libzonecfg.h> +#include <zone.h> #include "Pcontrol.h" @@ -124,7 +124,6 @@ Pfindexec(struct ps_prochandle *P, const char *aout, */ if ((addr = Pgetauxval(P, AT_SUN_EXECNAME)) != (uintptr_t)-1L && Pread_string(P, path, sizeof (path), (off_t)addr) > 0) { - char zname[ZONENAME_MAX]; char zpath[PATH_MAX]; const psinfo_t *pi = Ppsinfo(P); @@ -135,10 +134,19 @@ Pfindexec(struct ps_prochandle *P, const char *aout, try_exec(cwd, p, buf, isexec, isdata)) goto found; - if (getzonenamebyid(pi->pr_zoneid, zname, - sizeof (zname)) != -1 && strcmp(zname, "global") != 0 && - zone_get_zonepath(zname, zpath, sizeof (zpath)) == Z_OK) { - (void) strcat(zpath, "/root"); + if (getzoneid() == GLOBAL_ZONEID && + pi->pr_zoneid != GLOBAL_ZONEID && + zone_getattr(pi->pr_zoneid, ZONE_ATTR_ROOT, zpath, + sizeof (zpath)) != -1) { + /* + * try_exec() only combines its cwd and path arguments + * if path is relative; but in our case even an absolute + * path inside a zone is a relative path from the global + * zone perspective. So we turn a non-global zone's + * absolute path into a relative path here before + * calling try_exec(). + */ + p = (path[0] == '/') ? path + 1 : path; if (try_exec(zpath, p, buf, isexec, isdata)) goto found; } |