Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 01d0c3742679f7e0cd581ee5240ce225 > files > 15

util-linux-2.22.2-5.mga3.src.rpm

--- util-linux-2.21/login-utils/login.c.orig	2012-02-28 00:07:03.408667742 +0000
+++ util-linux-2.21/login-utils/login.c	2012-02-28 00:20:24.564663541 +0000
@@ -1129,6 +1129,7 @@
 	struct passwd *pwd = cxt->pwd;
 	char *termenv = NULL, **env;
 	char tmp[PATH_MAX];
+	const char *path;
 	int len, i;
 
 	termenv = getenv("TERM");
@@ -1145,13 +1146,16 @@
 	setenv("TERM", termenv, 1);
 
 	if (pwd->pw_uid)
-		setenv("PATH", getlogindefs_str("ENV_PATH", _PATH_DEFPATH), 1);
+		path = getlogindefs_str("ENV_PATH", _PATH_DEFPATH);
 	else {
-		const char *x = getlogindefs_str("ENV_ROOTPATH", NULL);
-		if (!x)
-			x = getlogindefs_str("ENV_SUPATH", _PATH_DEFPATH_ROOT);
-		setenv("PATH", x, 1);
+		path = getlogindefs_str("ENV_ROOTPATH", NULL);
+		if (!path)
+			path = getlogindefs_str("ENV_SUPATH", _PATH_DEFPATH_ROOT);
 	}
+	if (strlen(path) >= 5 && strncmp(path, "PATH=", 5) == 0)
+		setenv("PATH", path+5, 1);
+	else
+		setenv("PATH", path, 1);
 
 	/* mailx will give a funny error msg if you forget this one */
 	len = snprintf(tmp, sizeof(tmp), "%s/%s", _PATH_MAILDIR, pwd->pw_name);