xsetenv("USER", pwd->pw_name, 1);
xsetenv("SHELL", pwd->pw_shell, 1);
- if (pwd->pw_uid) {
- if (logindefs_setenv("PATH", "ENV_PATH", _PATH_DEFPATH) != 0)
- err(EXIT_FAILURE, _("failed to set the %s environment variable"), "PATH");
-
- } else if (logindefs_setenv("PATH", "ENV_ROOTPATH", NULL) != 0 &&
- logindefs_setenv("PATH", "ENV_SUPATH", _PATH_DEFPATH_ROOT) != 0) {
- err(EXIT_FAILURE, _("failed to set the %s environment variable"), "PATH");
- }
+ if (logindefs_setenv_path(pwd->pw_uid) != 0)
+ err(EXIT_FAILURE, _("failed to set the PATH environment variable"));
/* mailx will give a funny error msg if you forget this one */
len = snprintf(tmp, sizeof(tmp), "%s/%s", _PATH_MAILDIR, pwd->pw_name);