File tree Expand file tree Collapse file tree 4 files changed +25
-9
lines changed
Expand file tree Collapse file tree 4 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,16 @@ if get_option('split-usr') == 'auto'
5959else
6060 split_usr = get_option (' split-usr' ) == ' true'
6161endif
62- conf.set10(' HAVE_SPLIT_USR' , split_usr)
62+ conf.set10(' HAVE_SPLIT_USR' , split_usr,
63+ description : ' /usr/bin and /bin directories are separate' )
6364
6465if get_option (' split-bin' ) == ' auto'
6566 split_bin = run_command (' test' , ' -L' , ' /usr/sbin' ).returncode() != 0
6667else
6768 split_bin = get_option (' split-bin' ) == ' true'
6869endif
70+ conf.set10(' HAVE_SPLIT_BIN' , split_bin,
71+ description : ' bin and sbin directories are separate' )
6972
7073rootprefixdir = get_option (' rootprefix' )
7174# Unusual rootprefixdir values are used by some distros
Original file line number Diff line number Diff line change 2828#include "string-util.h"
2929#include "time-util.h"
3030
31- #define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
32- #define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin"
31+ #if HAVE_SPLIT_BIN
32+ # define PATH_SBIN_BIN (x ) x "sbin:" x "bin"
33+ #else
34+ # define PATH_SBIN_BIN (x ) x "bin"
35+ #endif
36+
37+ #define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/")
38+ #define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/")
3339
3440#if HAVE_SPLIT_USR
3541# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
Original file line number Diff line number Diff line change @@ -152,7 +152,9 @@ static const MountEntry protect_system_yes_table[] = {
152152 { "/lib" , READONLY , true },
153153 { "/lib64" , READONLY , true },
154154 { "/bin" , READONLY , true },
155+ # if HAVE_SPLIT_BIN
155156 { "/sbin" , READONLY , true },
157+ # endif
156158#endif
157159};
158160
@@ -166,7 +168,9 @@ static const MountEntry protect_system_full_table[] = {
166168 { "/lib" , READONLY , true },
167169 { "/lib64" , READONLY , true },
168170 { "/bin" , READONLY , true },
171+ # if HAVE_SPLIT_BIN
169172 { "/sbin" , READONLY , true },
173+ # endif
170174#endif
171175};
172176
Original file line number Diff line number Diff line change @@ -478,6 +478,12 @@ static int search_from_environment(
478478 return 0 ;
479479}
480480
481+ #if HAVE_SPLIT_BIN
482+ # define ARRAY_SBIN_BIN (x ) x "sbin", x "bin"
483+ #else
484+ # define ARRAY_SBIN_BIN (x ) x "bin"
485+ #endif
486+
481487static int get_search (uint64_t type , char * * * list ) {
482488
483489 assert (list );
@@ -490,13 +496,10 @@ static int get_search(uint64_t type, char ***list) {
490496 ".local/bin" ,
491497 "PATH" ,
492498 true,
493- "/usr/local/sbin" ,
494- "/usr/local/bin" ,
495- "/usr/sbin" ,
496- "/usr/bin" ,
499+ ARRAY_SBIN_BIN ("/usr/local/" ),
500+ ARRAY_SBIN_BIN ("/usr/" ),
497501#if HAVE_SPLIT_USR
498- "/sbin" ,
499- "/bin" ,
502+ ARRAY_SBIN_BIN ("/" ),
500503#endif
501504 NULL );
502505
You can’t perform that action at this time.
0 commit comments