chiark / gitweb /
Prep v234: Apply missing upstream fixes in src/basic (1/6)
authorSven Eden <yamakuzure@gmx.net>
Tue, 25 Jul 2017 08:19:24 +0000 (10:19 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 25 Jul 2017 09:43:49 +0000 (11:43 +0200)
src/basic/cgroup-util.c
src/basic/exec-util.h
src/basic/process-util.h
src/basic/selinux-util.c
src/basic/strv.c
src/basic/strv.h

index 0f4c955a01491e9e3ac0054dcb6ff36c1362ca07..315c449656aa073ce6aadad84e0506b82e246a6f 100644 (file)
@@ -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;
 
index 0c47ccb2f43a313b1ff1918e7e53d40e14cf8c14..a89f9bc68c9f32e9e4b85dbe81e4613d5f6e18de 100644 (file)
@@ -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
-
index f73d598d81a03d4740e53b158443e8bb24b01f0a..171e871896529d82a29f55d7f83b0e9ff2a83aff 100644 (file)
@@ -29,7 +29,7 @@
 #include <sys/types.h>
 
 #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
index 41c8297f9b53e6aa9a54b60b6a9ebd65988bad2a..c7a04ad7644402f23f10a52f8097f7df2f383d65 100644 (file)
@@ -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;
 
 
index f0c764b17ae16dc74cd53a485d8dcf78f21bc57c..1f42046c6bca241186bcf8938b05a5e4497aa541 100644 (file)
@@ -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;
index 1433e896daf939745fdb7178ab55f5943435e215..a01f685f9b512c10e0b4aa12e54384113ffe4ccf 100644 (file)
@@ -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