Skip to content

Commit 69b5347

Browse files
authored
Fix safepath to match de-facto Linux standards
Linux distributions place `/usr/local` directories before their non-local counterparts in `$PATH`. Unlike BSD, Linux distributions don't put packaged executables under `/usr/local`, instead it is used by the local user to place their own executables, potentially to replace system executables.
1 parent b96106b commit 69b5347

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

doas.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ mygetpwuid_r(uid_t uid, struct passwd *pwd, struct passwd **result)
238238
int
239239
main(int argc, char **argv)
240240
{
241-
const char *safepath = "/bin:/sbin:/usr/bin:/usr/sbin:"
242-
"/usr/local/bin:/usr/local/sbin";
241+
const char *safepath = "/usr/local/bin:/usr/local/sbin:"
242+
"/bin:/sbin:/usr/bin:/usr/sbin";
243243
const char *confpath = NULL;
244244
char *shargv[] = { NULL, NULL };
245245
char *sh;

0 commit comments

Comments
 (0)