changeset 10032:087ec449fca8

6767793 removef returns $BASEDIR if the $BASEDIR is not "/"
author phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India <Phaniram.Krishnamurthy@Sun.COM>
date Fri, 03 Jul 2009 13:30:39 +0530
parents 7c57d4b0e54f
children fbf01e219914
files usr/src/cmd/svr4pkg/installf/main.c
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/svr4pkg/installf/main.c	Thu Jul 02 22:10:52 2009 -0400
+++ b/usr/src/cmd/svr4pkg/installf/main.c	Fri Jul 03 13:30:39 2009 +0530
@@ -135,6 +135,7 @@
 	char		*prog;
 	char		*pt;
 	char		*vfstab_file = NULL;
+	char		*temp_cl_basedir;
 	char		outbuf[PATH_MAX];
 	int		c;
 	int		dbchg;
@@ -434,10 +435,24 @@
 
 				c = 0;
 				if (is_a_cl_basedir() && !is_an_inst_root()) {
-					c = strlen(get_client_basedir());
-					(void) snprintf(outbuf, sizeof (outbuf),
-					    "%s/%s\n", get_basedir(),
-					    &(ept->path[c]));
+					/*
+					 * A path in contents db might have
+					 * other prefix than BASEDIR of the
+					 * package
+					 */
+					temp_cl_basedir = get_client_basedir();
+					if (strncmp(ept->path, temp_cl_basedir,
+					    strlen(temp_cl_basedir)) == 0) {
+						c = strlen(temp_cl_basedir);
+						(void) snprintf(outbuf,
+						    sizeof (outbuf), "%s/%s\n",
+						    get_basedir(),
+						    &(ept->path[c]));
+					} else {
+						(void) snprintf(outbuf,
+						    sizeof (outbuf),
+						    "%s\n", &(ept->path[c]));
+					}
 				} else if (is_an_inst_root()) {
 					(void) snprintf(outbuf, sizeof (outbuf),
 					    "%s/%s\n", get_inst_root(),