chiark / gitweb /
Prep v239: Add missing updates that evaded migration.
authorSven Eden <yamakuzure@gmx.net>
Tue, 14 Aug 2018 16:39:33 +0000 (18:39 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
39 files changed:
man/sd-bus.xml
man/sd_bus_creds_get_pid.xml
man/sd_bus_creds_new_from_pid.xml
man/sd_bus_default.xml
man/sd_bus_error.xml
man/sd_bus_message_append.xml
man/sd_bus_message_append_array.xml
man/sd_bus_message_append_basic.xml
man/sd_bus_message_append_string_memfd.xml
man/sd_bus_message_append_strv.xml
man/sd_bus_new.xml
man/sd_bus_path_encode.xml
man/sd_event_add_child.xml
man/sd_event_add_defer.xml
man/sd_event_add_inotify.xml
man/sd_event_add_signal.xml
man/sd_event_get_fd.xml
man/sd_event_run.xml
man/sd_event_source_set_description.xml
man/sd_event_wait.xml
src/basic/cgroup-util.c
src/basic/copy.c
src/basic/fileio.c
src/basic/fs-util.c
src/basic/fs-util.h
src/basic/log.h
src/basic/selinux-util.h
src/basic/user-util.c
src/basic/user-util.h
src/libelogind/libelogind.pc.in
src/login/logind-dbus.c
src/login/logind-gperf.gperf
src/login/logind-user.c
src/systemd/sd-event.h
src/test/test-bus-util.c
src/test/test-fd-util.c
src/test/test-string-util.c
tools/make-directive-index.py
tools/make-man-index.py

index f7a959cb1e2b4b6411ed3d86a17ee89b0a8aee59..95e0e227b9f2fc58d5f6a534f8e305c50ac51dc3 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2016 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd-bus" xmlns:xi="http://www.w3.org/2001/XInclude">
index fd5fe1c54a693fb03b25449a7c8d0258b40eb2a9..d1bda1127cf677f6fb295e6f5ddcfcc0c3676263 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_creds_get_pid" xmlns:xi="http://www.w3.org/2001/XInclude">
index ee3d4e17129145231c0123c75c586c34c79509a2..dd9add13dbab4fac8e9a4524812c531f70847581 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_creds_new_from_pid" xmlns:xi="http://www.w3.org/2001/XInclude">
index c4e13a8362286cdc697f83e322ca20cc00a0632d..548e053b89f3ba490fec60dc37337bc6334c48b5 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_default" xmlns:xi="http://www.w3.org/2001/XInclude">
index 31be55fc9247fe86b4b1c1443cea2417ead509ea..070032bfea8f779312799c9138d504cebd8e1614 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_error" xmlns:xi="http://www.w3.org/2001/XInclude">
index 9a040f991c113ace6694a721f0ae94661bd63c00..ff3428a3927ef5b663dc9d2cf56fe6e73648dc7d 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_message_append"
index 33221398e43b5b2812fea48cd164272e69b0d4d9..12bd10504e3dd35b2c18bb7d908316424022d59b 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_message_append_array"
index fede4deea09ded261d8355b7973e41f7c18807eb..d1fbf4059dbe8bd944081e73bf2d4333608d80a4 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_message_append_basic" xmlns:xi="http://www.w3.org/2001/XInclude">
index 8b7e371946b6f505a98a54bb7b4de400fc4c6a57..f2de80abf45cb260c235a47ab2cb0963cead9092 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_message_append_string_memfd"
index b2ebc0cd727c0d7fccfc84afd4561a4b8e31db51..311aacb49d22694c97c564339d29b7fb2853312e 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_message_append_strv"
index 7c8d509965f91712d3ea886be30a81cfe5337de6..3a092da2246821e55bf3175814741b925afc43c2 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_new" xmlns:xi="http://www.w3.org/2001/XInclude">
index 5464e96cd30061cf087ffdfe34fd78f441fa4d3a..d0a16ebfc6a46aeaac3bb8935223fd2317e3c4ac 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_bus_path_encode">
index ed461a1d95f82ae54019b772b3aa36eb57bc8f20..6ec9a8f1d6c08fc7f523e4368c0aeb8b47bddde1 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_event_add_child" xmlns:xi="http://www.w3.org/2001/XInclude">
index 76c7a74cbf4df132d5bd3ee1cf272c1f416af03a..a48793cf25fd04d3c36ded0f155a17e3ecbae955 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_event_add_defer" xmlns:xi="http://www.w3.org/2001/XInclude">
index ded7a53bf178ad7e83a91a020742332a4f1b50d2..79d866bf615cfedbd92409243995cb1a14dba124 100644 (file)
   </refsect1>
 
   <xi:include href="libelogind-pkgconfig.xml" />
+  <refsect1>
+    <title>Examples</title>
+
+    <example>
+      <title>A simple program that uses inotify to monitor one or two directories</title>
+
+      <programlisting><xi:include href="inotify-watch-tmp.c" parse="text" /></programlisting>
+    </example>
+  </refsect1>
+
 
   <refsect1>
     <title>See Also</title>
index a82de268f231c30d09561b00b6ee00270ee86919..4c715dff787ddbc06f6c288fd628e9c66342579f 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_event_add_signal" xmlns:xi="http://www.w3.org/2001/XInclude">
index 8dcfde807afc8346ea4b0d5c916d1e18fa19380c..61fb83ce60f863e40e646733b09f1ca43695ea2e 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_event_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
index 2b163e7fff4c8848ed48cbd815bb1330cbd72156..988eefa1b768fbf26ddd93a7e42c9e424fc97a55 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2015 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_event_run" xmlns:xi="http://www.w3.org/2001/XInclude">
index af9ca284bed1e89335f1170f5d8e6cc2801747c1..c83396ccad713994a00547cba599ec2aada5933c 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2014 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_event_source_set_description" xmlns:xi="http://www.w3.org/2001/XInclude">
index 9e2879fb7917a0f82aa475f88d5b762002863d54..6fb04661fb0a27cbb825941b72272ceb244bd070 100644 (file)
@@ -4,8 +4,6 @@
 
 <!--
   SPDX-License-Identifier: LGPL-2.1+
-
-  Copyright © 2015 Zbigniew Jędrzejewski-Szmek
 -->
 
 <refentry id="sd_event_wait" xmlns:xi="http://www.w3.org/2001/XInclude">
index 1994104e6fb2d4bae5b4c469e3470315a80dc017..dd2f3e86621f6f8ec4040b09a8fd5246613410e3 100644 (file)
@@ -1807,7 +1807,7 @@ int cg_path_get_owner_uid(const char *path, uid_t *uid) {
 #else
         p = strappend("/run/systemd/sessions/", slice);
 
-        r = parse_env_file(p, NEWLINE, "UID", &s, NULL);
+        r = parse_env_file(NULL, p, NEWLINE, "UID", &s, NULL);
         if (r == -ENOENT)
                 return -ENXIO;
         if (r < 0)
index 55b90bc47ceae7054e4b29fd11f16314e0863d97..1b1e512b83c19060a8de38d37e1d9d9f922374a3 100644 (file)
@@ -716,31 +716,55 @@ int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned
 }
 
 int copy_file_atomic(const char *from, const char *to, mode_t mode, unsigned chattr_flags, CopyFlags copy_flags) {
-        _cleanup_free_ char *t = NULL;
+        _cleanup_(unlink_and_freep) char *t = NULL;
+        _cleanup_close_ int fdt = -1;
         int r;
 
         assert(from);
         assert(to);
 
-        r = tempfn_random(to, NULL, &t);
-        if (r < 0)
-                return r;
+        /* We try to use O_TMPFILE here to create the file if we can. Note that that only works if COPY_REPLACE is not
+         * set though as we need to use linkat() for linking the O_TMPFILE file into the file system but that system
+         * call can't replace existing files. Hence, if COPY_REPLACE is set we create a temporary name in the file
+         * system right-away and unconditionally which we then can renameat() to the right name after we completed
+         * writing it. */
+
+        if (copy_flags & COPY_REPLACE) {
+                r = tempfn_random(to, NULL, &t);
+                if (r < 0)
+                        return r;
+
+                fdt = open(t, O_CREAT|O_EXCL|O_NOFOLLOW|O_NOCTTY|O_WRONLY|O_CLOEXEC, 0600);
+                if (fdt < 0) {
+                        t = mfree(t);
+                        return -errno;
+                }
+        } else {
+                fdt = open_tmpfile_linkable(to, O_WRONLY|O_CLOEXEC, &t);
+                if (fdt < 0)
+                        return fdt;
+        }
 
-        r = copy_file(from, t, O_NOFOLLOW|O_EXCL, mode, chattr_flags, copy_flags);
+        if (chattr_flags != 0)
+                (void) chattr_fd(fdt, chattr_flags, (unsigned) -1);
+
+        r = copy_file_fd(from, fdt, copy_flags);
         if (r < 0)
                 return r;
 
+        if (fchmod(fdt, mode) < 0)
+                return -errno;
+
         if (copy_flags & COPY_REPLACE) {
-                r = renameat(AT_FDCWD, t, AT_FDCWD, to);
+                if (renameat(AT_FDCWD, t, AT_FDCWD, to) < 0)
+                        return -errno;
+        } else {
+                r = link_tmpfile(fdt, t, to);
                 if (r < 0)
-                        r = -errno;
-        } else
-                r = rename_noreplace(AT_FDCWD, t, AT_FDCWD, to);
-        if (r < 0) {
-                (void) unlink(t);
-                return r;
+                        return r;
         }
 
+        t = mfree(t);
         return 0;
 }
 
index 60573f2ef84c908be3da2726375d1c09100ddbcf..1cee6d49594e7f5f88730eba9234cfcb77040de8 100644 (file)
@@ -1566,21 +1566,29 @@ int read_nul_string(FILE *f, char **ret) {
 }
 
 int mkdtemp_malloc(const char *template, char **ret) {
-        char *p;
+        _cleanup_free_ char *p = NULL;
+        int r;
 
-        assert(template);
         assert(ret);
 
-        p = strdup(template);
+        if (template)
+                p = strdup(template);
+        else {
+                const char *tmp;
+
+                r = tmp_dir(&tmp);
+                if (r < 0)
+                        return r;
+
+                p = strjoin(tmp, "/XXXXXX");
+        }
         if (!p)
                 return -ENOMEM;
 
-        if (!mkdtemp(p)) {
-                free(p);
+        if (!mkdtemp(p))
                 return -errno;
-        }
 
-        *ret = p;
+        *ret = TAKE_PTR(p);
         return 0;
 }
 #endif // 0
index 942f43ae938f4d56005ce86bff35dae2e8b70974..5a9b1c950f26bc1533d4f343e4d0b22487967d35 100644 (file)
@@ -234,6 +234,22 @@ int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) {
         return 0;
 }
 
+int fchmod_and_chown(int fd, mode_t mode, uid_t uid, gid_t gid) {
+        /* Under the assumption that we are running privileged we
+         * first change the access mode and only then hand out
+         * ownership to avoid a window where access is too open. */
+
+        if (mode != MODE_INVALID)
+                if (fchmod(fd, mode) < 0)
+                        return -errno;
+
+        if (uid != UID_INVALID || gid != GID_INVALID)
+                if (fchown(fd, uid, gid) < 0)
+                        return -errno;
+
+        return 0;
+}
+
 int fchmod_umask(int fd, mode_t m) {
         mode_t u;
         int r;
index 6cb7345f525a25447c5adbc3b3fc9f61a93295c9..e7ca039687fd50528b7e88f150921a7b8e5b0a12 100644 (file)
@@ -31,6 +31,7 @@ int readlink_and_make_absolute(const char *p, char **r);
 #endif // 0
 
 int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
+int fchmod_and_chown(int fd, mode_t mode, uid_t uid, gid_t gid);
 
 int fchmod_umask(int fd, mode_t mode);
 int fchmod_opath(int fd, mode_t m);
index 5b5dfe8b58075e18e5ee2ca34e55bf9e11f9f0a7..e4caece30875eb9315d701481aefd64620fac02b 100644 (file)
@@ -246,7 +246,6 @@ int log_emergency_level(void);
 /* Structured logging */
 #define log_struct_errno(level, error, ...) \
         log_struct_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, level), \
-                            error, __FILE__, __LINE__, __func__, __VA_ARGS__)
                             error, __FILE__, __LINE__, __func__, __VA_ARGS__, NULL)
 #define log_struct(level, ...) log_struct_errno(level, 0, __VA_ARGS__)
 
index bba623e57d11e77ba0a06651f0bba35aec0f6da5..b2a0d6dd46e834ad44519e554c8adf38a3314ec3 100644 (file)
@@ -6,7 +6,7 @@
 #include <sys/types.h>
 
 #include "macro.h"
-//#include "label.h"
+#include "label.h"
 
 bool mac_selinux_use(void);
 void mac_selinux_retest(void);
index 6218c6fed5679df7555863bd49cd881305a1a7c6..7bc5ba7e098c1d76a98067a86419faa7e17f0086 100644 (file)
@@ -724,6 +724,7 @@ bool synthesize_nobody(void) {
 #endif
 }
 
+#if 0 /// UNNEEDED by elogind
 int putpwent_sane(const struct passwd *pw, FILE *stream) {
         assert(pw);
         assert(stream);
@@ -831,3 +832,4 @@ int fgetsgent_sane(FILE *stream, struct sgrp **sg) {
         return !!s;
 }
 #endif
+#endif // 0
index bd6d8d3c485c85aedb2a45ed3993bfc864908d28..14a4d180c661578aa944176a758604277a523374 100644 (file)
@@ -106,6 +106,7 @@ int maybe_setgroups(size_t size, const gid_t *list);
 
 bool synthesize_nobody(void);
 
+#if 0 /// UNNEEDED by elogind
 int fgetpwent_sane(FILE *stream, struct passwd **pw);
 int fgetspent_sane(FILE *stream, struct spwd **sp);
 int fgetgrent_sane(FILE *stream, struct group **gr);
@@ -116,3 +117,4 @@ int putgrent_sane(const struct group *gr, FILE *stream);
 int fgetsgent_sane(FILE *stream, struct sgrp **sg);
 int putsgent_sane(const struct sgrp *sg, FILE *stream);
 #endif
+#endif // 0
index 64e34a3d1a4441b9e62f43c8ca35a5cab5610e9f..2fd18b9831258b647bef2fbddc5643dc6fa5c524 100644 (file)
@@ -1,8 +1,8 @@
-#  This file is part of elogind.
 #  SPDX-License-Identifier: LGPL-2.1+
 #
-#  elogind is free software; you can redistribute it and/or modify it
+#  This file is part of elogind.
 #
+#  elogind 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.
index 7706c408e19e157e6a89ff8fc3868fc9f8cf03f9..f9d0b1c9f57320e3dc4cc1fd7fe692408000a9b8 100644 (file)
@@ -2367,6 +2367,7 @@ static int method_can_shutdown_or_sleep(
                 const char *target;
 
                 target = manager_target_for_action(handle);
+#if 0 /// elogind does not support systemd units units. A valid handle is enough
                 if (target) {
                         _cleanup_free_ char *load_state = NULL;
 
@@ -2375,9 +2376,14 @@ static int method_can_shutdown_or_sleep(
                                 return r;
 
                         if (!streq(load_state, "loaded")) {
+#else
+                if (NULL == target) {
+#endif // 0
                                 result = "no";
                                 goto finish;
+#if 0 /// one less with elogind...
                         }
+#endif // 0
                 }
         }
 
index 90c346b927a89aeb286e4fc275b20dc3a9652aa0..80e9e8c20664ae6b80e6200ad5732ebe61b2b75a 100644 (file)
@@ -17,8 +17,6 @@ struct ConfigPerfItem;
 %struct-type
 %includes
 %%
-#if 0 /// UNNEEDED by elogind
-#endif // 0
 #if 1 /// Additions for elogind
 Sleep.SuspendMode,                 config_parse_strv,          0, offsetof(Manager, suspend_mode)
 Sleep.SuspendState,                config_parse_strv,          0, offsetof(Manager, suspend_state)
@@ -27,8 +25,10 @@ Sleep.HibernateState,              config_parse_strv,          0, offsetof(Manag
 Sleep.HybridSleepMode,             config_parse_strv,          0, offsetof(Manager, hybrid_sleep_mode)
 Sleep.HybridSleepState,            config_parse_strv,          0, offsetof(Manager, hybrid_sleep_state)
 #endif // 1
-Login.NAutoVTs,                     config_parse_n_autovts,             0, offsetof(Manager, n_autovts)
-Login.ReserveVT,                    config_parse_unsigned,              0, offsetof(Manager, reserve_vt)
+#if 0 /// UNNEEDED by elogind
+# Login.NAutoVTs,                     config_parse_n_autovts,             0, offsetof(Manager, n_autovts)
+# Login.ReserveVT,                    config_parse_unsigned,              0, offsetof(Manager, reserve_vt)
+#endif // 0
 Login.KillUserProcesses,            config_parse_bool,                  0, offsetof(Manager, kill_user_processes)
 Login.KillOnlyUsers,                config_parse_strv,                  0, offsetof(Manager, kill_only_users)
 Login.KillExcludeUsers,             config_parse_strv,                  0, offsetof(Manager, kill_exclude_users)
index c5a49e1b67aa6440ae68c1120acfdd1b56414d89..60e862e3b0b296b029f8a1de94246db178f43d94 100644 (file)
@@ -317,12 +317,6 @@ int user_load(User *u) {
 }
 
 
-#if 0 /// elogind can not ask systemd via dbus to start user services
-#else
-        assert(u);
-
-        hashmap_put(u->manager->user_units, u->slice, u);
-#endif // 0
 static int user_start_service(User *u) {
 #if 0 /// elogind can not ask systemd via dbus to start user services
         _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
index ea1f313b055c2c70482844a6607bb8b0dc6ecc23..e6f2c50a85ce8ba7a10fa6a4fe62cb22f6902658 100644 (file)
@@ -21,7 +21,7 @@
 #include <inttypes.h>
 #include <signal.h>
 #include <sys/epoll.h>
-//#include <sys/inotify.h>
+#include <sys/inotify.h>
 #include <sys/signalfd.h>
 #include <sys/types.h>
 /*#include <time.h>*/
index 608052be1159ce5be7854a8b3b33d53473e6bc68..a320a0d787e4d3cf479e3e38796cf456bef45512 100644 (file)
@@ -35,6 +35,48 @@ static void test_name_async(unsigned n_messages) {
         }
 }
 
+static int callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
+        return 1;
+}
+
+static void destroy_callback(void *userdata) {
+        int *n_called = userdata;
+
+        (*n_called) ++;
+}
+
+static void test_destroy_callback(void) {
+        _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+        sd_bus_slot *slot = NULL;
+        sd_bus_destroy_t t;
+
+        int r, n_called = 0;
+
+        log_info("/* %s */", __func__);
+
+        r = bus_open_system_watch_bind_with_description(&bus, "test-bus");
+        if (r < 0) {
+                log_error_errno(r, "Failed to connect to bus: %m");
+                return;
+        }
+
+        r = sd_bus_request_name_async(bus, &slot, "org.freedesktop.elogind.test-bus-util", 0, callback, &n_called);
+        assert(r == 1);
+
+        assert_se(sd_bus_slot_get_destroy_callback(slot, NULL) == 0);
+        assert_se(sd_bus_slot_get_destroy_callback(slot, &t) == 0);
+
+        assert_se(sd_bus_slot_set_destroy_callback(slot, destroy_callback) == 0);
+        assert_se(sd_bus_slot_get_destroy_callback(slot, NULL) == 1);
+        assert_se(sd_bus_slot_get_destroy_callback(slot, &t) == 1);
+        assert_se(t == destroy_callback);
+
+        /* Force cleanup so we can look at n_called */
+        assert(n_called == 0);
+        sd_bus_slot_unref(slot);
+        assert(n_called == 1);
+}
+
 int main(int argc, char **argv) {
         log_set_max_level(LOG_DEBUG);
         log_parse_environment();
@@ -42,6 +84,7 @@ int main(int argc, char **argv) {
 
         test_name_async(0);
         test_name_async(20);
+        test_destroy_callback();
 
         return 0;
 }
index 2b6cd05118e7e5fbeac74069105eaa0e6141bf5a..4328442ade62c5dc0af2acb6e36e31c261577a03 100644 (file)
@@ -246,6 +246,7 @@ static void assert_equal_fd(int fd1, int fd2) {
         }
 }
 
+#if 0 /// UNNEEDED by elogind
 static void test_fd_duplicate_data_fd(void) {
         _cleanup_close_ int fd1 = -1, fd2 = -1;
         _cleanup_(close_pairp) int sfd[2] = { -1, -1 };
@@ -311,6 +312,7 @@ static void test_fd_duplicate_data_fd(void) {
 
         assert_se(read(fd2, &j, sizeof(j)) == 0);
 }
+#endif // 0
 
 static void test_read_nr_open(void) {
         log_info("nr-open: %i", read_nr_open());
@@ -329,7 +331,9 @@ int main(int argc, char *argv[]) {
         test_acquire_data_fd();
         test_fd_move_above_stdio();
         test_rearrange_stdio();
+#if 0 /// UNNEEDED by elogind
         test_fd_duplicate_data_fd();
+#endif // 0
         test_read_nr_open();
 
         return 0;
index 7860499b764492124b35ff5d3e69e9837367fa07..47032729e09c43a4467a7574bd87a177e18034a3 100644 (file)
@@ -431,7 +431,6 @@ static void test_delete_trailing_slashes(void) {
         assert_se(streq(delete_trailing_chars(s4, "/"), ""));
 }
 
-#if 0 /// UNNEEDED by elogind
 static void test_skip_leading_chars(void) {
         char input1[] = " \n \r k \n \r ",
                 input2[] = "kkkkthiskkkiskkkaktestkkk",
@@ -443,7 +442,6 @@ static void test_skip_leading_chars(void) {
         assert_se(streq(skip_leading_chars(input3, WHITESPACE), "abcdef"));
         assert_se(streq(skip_leading_chars(input3, "bcaef"), "def"));
 }
-#endif // 0
 
 static void test_in_charset(void) {
         assert_se(in_charset("dddaaabbbcccc", "abcd"));
@@ -533,9 +531,7 @@ int main(int argc, char *argv[]) {
 #endif // 0
         test_delete_trailing_chars();
         test_delete_trailing_slashes();
-#if 0 /// UNNEEDED by elogind
         test_skip_leading_chars();
-#endif // 0
         test_in_charset();
         test_split_pair();
         test_first_word();
index ef407324d6602fcff4e5274979f3b71e347c9867..620a67e97b32fcbaf620db6e9892895315e5472a 100755 (executable)
@@ -1,8 +1,6 @@
 #!/usr/bin/env python3
 #  -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
 # SPDX-License-Identifier: LGPL-2.1+
-#
-#  Copyright © 2012-2013 Zbigniew Jędrzejewski-Szmek
 
 import sys
 import collections
index 70c02a8d7acb45f36ff93cd19cbc3bd8c44a5d91..246ce5f8e2194b1a962a0012272f2b7f2f3132cf 100755 (executable)
@@ -1,8 +1,6 @@
 #!/usr/bin/env python3
 #  -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
 # SPDX-License-Identifier: LGPL-2.1+
-#
-#  Copyright © 2013 Zbigniew Jędrzejewski-Szmek
 
 import collections
 import sys