login.c: Do not overwrite the PATH variable if config.path element is empty (#135)

This allows disabling the feature if PATH was already set (e.g. by the systemd session
slice) and the user wishes to honor that.

Signed-off-by: Roosembert Palacios <roosembert.palacios@epfl.ch>
This commit is contained in:
Roosemberth Palacios
2019-10-31 00:03:35 +01:00
committed by cylgom
parent 1796a355bc
commit 38fefffdf6

View File

@@ -229,7 +229,9 @@ void env_init(struct passwd* pwd, const char* display_name)
setenv("DISPLAY", display_name, 1); setenv("DISPLAY", display_name, 1);
setenv("LANG", lang, 1); setenv("LANG", lang, 1);
// path // Set PATH if specified in the configuration
if (strlen(config.path))
{
int ok = setenv("PATH", config.path, 1); int ok = setenv("PATH", config.path, 1);
if (ok != 0) if (ok != 0)
@@ -237,6 +239,7 @@ void env_init(struct passwd* pwd, const char* display_name)
dgn_throw(DGN_PATH); dgn_throw(DGN_PATH);
} }
} }
}
void env_xdg(const char* tty_id, const enum display_server display_server) void env_xdg(const char* tty_id, const enum display_server display_server)
{ {