mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Fix missing default PATH for root and non-root users.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
f94db7bceb
commit
814ffd9259
2 files changed
+9
-1
No files matched your search
@@ -134,6 +134,9 @@ int main(int argc, char* argv[])
|
|||||||
/* Set hostname as soon as possible, for syslog et al. */
|
/* Set hostname as soon as possible, for syslog et al. */
|
||||||
set_hostname(&hostname);
|
set_hostname(&hostname);
|
||||||
|
|
||||||
|
/* Set default PATH, for uid 0 */
|
||||||
|
setenv("PATH", _PATH_STDPATH);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mount filesystems
|
* Mount filesystems
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -230,9 +230,14 @@ int service_start(svc_t *svc)
|
|||||||
DFLSIG(sa, i, 0);
|
DFLSIG(sa, i, 0);
|
||||||
|
|
||||||
/* Set desired user */
|
/* Set desired user */
|
||||||
if (uid >= 0)
|
if (uid >= 0) {
|
||||||
setuid(uid);
|
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. */
|
/* 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++)
|
for (i = 0; i < (MAX_NUM_SVC_ARGS - 1) && svc->args[i][0] != 0; i++)
|
||||||
args[i] = svc->args[i];
|
args[i] = svc->args[i];
|
||||||
|
|||||||
Reference in new issue
Block a user