mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
Fix missing default PATH for root and non-root users.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -134,6 +134,9 @@ int main(int argc, char* argv[])
|
||||
/* Set hostname as soon as possible, for syslog et al. */
|
||||
set_hostname(&hostname);
|
||||
|
||||
/* Set default PATH, for uid 0 */
|
||||
setenv("PATH", _PATH_STDPATH);
|
||||
|
||||
/*
|
||||
* Mount filesystems
|
||||
*/
|
||||
|
||||
@@ -230,9 +230,14 @@ int service_start(svc_t *svc)
|
||||
DFLSIG(sa, i, 0);
|
||||
|
||||
/* Set desired user */
|
||||
if (uid >= 0)
|
||||
if (uid >= 0) {
|
||||
setuid(uid);
|
||||
|
||||
/* Set default path for regular users */
|
||||
if (uid > 0)
|
||||
setenv("PATH", _PATH_DEFPATH);
|
||||
}
|
||||
|
||||
/* Serve copy of args to process in case it modifies them. */
|
||||
for (i = 0; i < (MAX_NUM_SVC_ARGS - 1) && svc->args[i][0] != 0; i++)
|
||||
args[i] = svc->args[i];
|
||||
|
||||
Reference in New Issue
Block a user