chiark / gitweb /
Prep v233: Add missing updates from upstream in src/basic
authorSven Eden <yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:13:40 +0000 (17:13 +0200)
committerSven Eden <yamakuzure@gmx.net>
Mon, 17 Jul 2017 16:10:58 +0000 (18:10 +0200)
src/basic/cgroup-util.c
src/basic/fileio.c
src/basic/fileio.h
src/basic/fs-util.c
src/basic/khash.c
src/basic/khash.h
src/basic/missing_syscall.h

index 40e09d6f90605741351531363fe6a208ec3adae9..b5b669c0e3d7ed51cf690208c3ae9b6f811aa2e6 100644 (file)
@@ -2483,7 +2483,6 @@ int cg_all_unified(void) {
         return unified_cache >= CGROUP_UNIFIED_ALL;
 }
 
-#if 0 /// UNNEEDED by elogind
 int cg_hybrid_unified(void) {
         int r;
 
@@ -2500,6 +2499,7 @@ int cg_unified_flush(void) {
         return cg_unified_update();
 }
 
+#if 0 /// UNNEEDED by elogind
 int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p) {
         _cleanup_free_ char *fs = NULL;
         CGroupController c;
@@ -2605,19 +2605,14 @@ bool cg_is_hybrid_wanted(void) {
          * Since checking is expensive, cache a non-error result. */
         r = proc_cmdline_get_bool("systemd.legacy_systemd_cgroup_controller", &b);
 
-#else
-bool cg_is_legacy_wanted(void) {
-        return true;
         /* The meaning of the kernel option is reversed wrt. to the return value
          * of this function, hence the negation. */
-        return (wanted = r > 0 ? !b : false);
-        return (wanted = r > 0 ? b : false);
-}
-
-bool cg_is_legacy_systemd_controller_wanted(void) {
-        return cg_is_legacy_wanted() && !cg_is_unified_systemd_controller_wanted();
         return (wanted = r > 0 ? !b : is_default);
 }
+#else
+bool cg_is_legacy_wanted(void) {
+        return true;
+}
 #endif // 0
 
 #if 0 /// UNNEEDED by elogind
index 03238151c64694ea3222292ce2acbfae3f2d2c7f..822855c9d939e5dd92101bf1941536e6cbf57dc5 100644 (file)
@@ -788,7 +788,9 @@ static int merge_env_file_push(
         }
 
         expanded_value = replace_env(value, *env,
-                                     REPLACE_ENV_USE_ENVIRONMENT|REPLACE_ENV_ALLOW_BRACELESS);
+                                     REPLACE_ENV_USE_ENVIRONMENT|
+                                     REPLACE_ENV_ALLOW_BRACELESS|
+                                     REPLACE_ENV_ALLOW_EXTENDED);
         if (!expanded_value)
                 return -ENOMEM;
 
@@ -803,7 +805,7 @@ int merge_env_file(
                 const char *fname) {
 
         /* NOTE: this function supports braceful and braceless variable expansions,
-         * unlike other exported parsing functions.
+         * plus "extended" substitutions, unlike other exported parsing functions.
          */
 
         return parse_env_file_internal(f, fname, NEWLINE, merge_env_file_push, env, NULL);
index 860d9e15db01c4eadf6884d61b9ea423d4ff06f7..c380ed9fd424f47d2cb0fb37b1f9564447583c74 100644 (file)
@@ -51,6 +51,8 @@ int load_env_file(FILE *f, const char *fname, const char *separator, char ***l);
 int load_env_file_pairs(FILE *f, const char *fname, const char *separator, char ***l);
 
 #if 0 /// UNNEEDED by elogind
+int merge_env_file(char ***env, FILE *f, const char *fname);
+
 int write_env_file(const char *fname, char **l);
 
 int executable_is_script(const char *path, char **interpreter);
index 6308216deeaab1129dc04b54a9baa91f121540ce..eefdbb52d84243c9f6c3d4a091d4a88df2e621c2 100644 (file)
@@ -805,8 +805,10 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
                         return -ENOMEM;
         }
 
-        *ret = done;
-        done = NULL;
+        if (ret) {
+                *ret = done;
+                done = NULL;
+        }
 
         return exists;
 }
index c7884207ff5fcddb65513711e09d24fa317725ec..84648dc1c9463debfeca1e1d8cff9e1e3f9ff4be 100644 (file)
@@ -1,20 +1,20 @@
 /***
-  This file is part of elogind.
+  This file is part of systemd.
 
   Copyright 2016 Lennart Poettering
 
-  elogind is free software; you can redistribute it and/or modify it
+  systemd is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
-  elogind is distributed in the hope that it will be useful, but
+  systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public License
-  along with elogind; If not, see <http://www.gnu.org/licenses/>.
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
 #include <linux/if_alg.h>
@@ -143,7 +143,7 @@ int khash_dup(khash *h, khash **ret) {
 
         copy->fd = -1;
         copy->algorithm = strdup(h->algorithm);
-        if (!copy)
+        if (!copy->algorithm)
                 return -ENOMEM;
 
         copy->fd = accept4(h->fd, NULL, 0, SOCK_CLOEXEC);
index c0439b6b1f704810dfd44dc53f2a7ed70ea3d31c..410f3020e0474b9bda61af5c38a06a35919bc3b6 100644 (file)
@@ -1,22 +1,22 @@
 #pragma once
 
 /***
-  This file is part of elogind.
+  This file is part of systemd.
 
   Copyright 2016 Lennart Poettering
 
-  elogind is free software; you can redistribute it and/or modify it
+  systemd is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
-  elogind is distributed in the hope that it will be useful, but
+  systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public License
-  along with elogind; If not, see <http://www.gnu.org/licenses/>.
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
 #include <inttypes.h>
index 036b0055b2d1bdcb06c95a8c4fde7fa3540517a8..58423bd5574a98e3acaeacd722f66b833a2519aa 100644 (file)
@@ -189,6 +189,7 @@ static inline pid_t raw_getpid(void) {
 #endif
 }
 #endif // 0
+
 /* ======================================================================= */
 
 #if !HAVE_DECL_RENAMEAT2