From: Sven Eden Date: Tue, 25 Jul 2017 08:19:24 +0000 (+0200) Subject: Prep v234: Apply missing upstream fixes in src/basic (1/6) X-Git-Tag: chiark/234.4-1+devuan1.1+iwj1~64 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=d93247127eb2e073a6d3b5bcc67bcc4048d674fe;hp=f4fd78a9c10f3831cb24fa4b36aa4b7960377a16 Prep v234: Apply missing upstream fixes in src/basic (1/6) --- diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 0f4c955a0..315c44965 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -55,6 +55,7 @@ #include "stdio-util.h" #include "string-table.h" #include "string-util.h" +#include "strv.h" #include "unit-name.h" #include "user-util.h" @@ -1003,7 +1004,7 @@ int cg_get_xattr(const char *controller, const char *path, const char *name, voi int cg_pid_get_path(const char *controller, pid_t pid, char **path) { _cleanup_fclose_ FILE *f = NULL; char line[LINE_MAX]; - const char *fs, *controller_str; + const char *fs, *controller_str = NULL; size_t cs = 0; int unified; diff --git a/src/basic/exec-util.h b/src/basic/exec-util.h index 0c47ccb2f..a89f9bc68 100644 --- a/src/basic/exec-util.h +++ b/src/basic/exec-util.h @@ -40,4 +40,3 @@ int execute_directories( #if 0 /// UNNEEDED by elogind extern const gather_stdout_callback_t gather_environment[_STDOUT_CONSUME_MAX]; #endif // 0 - diff --git a/src/basic/process-util.h b/src/basic/process-util.h index f73d598d8..171e87189 100644 --- a/src/basic/process-util.h +++ b/src/basic/process-util.h @@ -29,7 +29,7 @@ #include #include "format-util.h" -#include "ioprio.h" +//#include "ioprio.h" #include "macro.h" #define procfs_file_alloca(pid, field) \ @@ -120,7 +120,6 @@ int pid_compare_func(const void *a, const void *b); static inline bool nice_is_valid(int n) { return n >= PRIO_MIN && n < PRIO_MAX; } -#endif // 0 static inline bool ioprio_class_is_valid(int i) { return IN_SET(i, IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE); @@ -131,3 +130,4 @@ static inline bool ioprio_priority_is_valid(int i) { } int ioprio_parse_priority(const char *s, int *ret); +#endif // 0 diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index 41c8297f9..c7a04ad76 100644 --- a/src/basic/selinux-util.c +++ b/src/basic/selinux-util.c @@ -53,7 +53,7 @@ static struct selabel_handle *label_hnd = NULL; #define log_enforcing(...) log_full_errno(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG, errno, __VA_ARGS__) #endif -bool mac_selinux_have(void) { +bool mac_selinux_use(void) { #ifdef HAVE_SELINUX if (cached_use < 0) cached_use = is_selinux_enabled() > 0; @@ -64,16 +64,6 @@ bool mac_selinux_have(void) { #endif } -bool mac_selinux_use(void) { - if (!mac_selinux_have()) - return false; - - /* Never try to configure SELinux features if we aren't - * root */ - - return getuid() == 0; -} - void mac_selinux_retest(void) { #ifdef HAVE_SELINUX cached_use = -1; @@ -206,7 +196,7 @@ int mac_selinux_get_create_label_from_exe(const char *exe, char **label) { assert(exe); assert(label); - if (!mac_selinux_have()) + if (!mac_selinux_use()) return -EOPNOTSUPP; r = getcon_raw(&mycon); @@ -232,7 +222,7 @@ int mac_selinux_get_our_label(char **label) { assert(label); #ifdef HAVE_SELINUX - if (!mac_selinux_have()) + if (!mac_selinux_use()) return -EOPNOTSUPP; r = getcon_raw(label); @@ -256,7 +246,7 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char * assert(exe); assert(label); - if (!mac_selinux_have()) + if (!mac_selinux_use()) return -EOPNOTSUPP; r = getcon_raw(&mycon); @@ -311,7 +301,7 @@ char* mac_selinux_free(char *label) { if (!label) return NULL; - if (!mac_selinux_have()) + if (!mac_selinux_use()) return NULL; diff --git a/src/basic/strv.c b/src/basic/strv.c index f0c764b17..1f42046c6 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -890,6 +890,7 @@ char **strv_skip(char **l, size_t n) { return l; } +#endif // 0 int strv_extend_n(char ***l, const char *value, size_t n) { size_t i, j, k; @@ -929,6 +930,7 @@ rollback: return -ENOMEM; } +#if 0 /// UNNEEDED by elogind int fputstrv(FILE *f, char **l, const char *separator, bool *space) { bool b = false; char **s; diff --git a/src/basic/strv.h b/src/basic/strv.h index 1433e896d..a01f685f9 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -191,8 +191,10 @@ static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, i char ***strv_free_free(char ***l); char **strv_skip(char **l, size_t n); +#endif // 0 int strv_extend_n(char ***l, const char *value, size_t n); +#if 0 /// UNNEEDED by elogind int fputstrv(FILE *f, char **l, const char *separator, bool *space); #endif // 0