]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #4133 from keszybz/strerror-removal
authorMartin Pitt <martin.pitt@ubuntu.com>
Wed, 14 Sep 2016 09:17:58 +0000 (11:17 +0200)
committerGitHub <noreply@github.com>
Wed, 14 Sep 2016 09:17:58 +0000 (11:17 +0200)
Strerror removal and other janitorial cleanups

25 files changed:
NEWS
hwdb/parse_hwdb.py
src/basic/fileio.c
src/basic/fileio.h
src/coredump/coredumpctl.c
src/journal/journalctl.c
src/journal/test-catalog.c
src/journal/test-compress.c
src/journal/test-mmap-cache.c
src/kernel-install/kernel-install
src/shared/ask-password-api.c
src/test/test-acl-util.c
src/test/test-async.c
src/test/test-clock.c
src/test/test-copy.c
src/test/test-fd-util.c
src/test/test-fdset.c
src/test/test-fileio.c
src/test/test-fs-util.c
src/test/test-glob-util.c
src/test/test-hostname-util.c
src/test/test-stat-util.c
src/test/test-terminal-util.c
src/test/test-tmpfiles.c
src/test/test-unit-file.c

diff --git a/NEWS b/NEWS
index 7ff4a44835353169250d2d9c781f2a83396debb3..178ccf9b04337c011f7f9215a9ef98644bde0432 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,11 +2,141 @@ systemd System and Service Manager
 
 CHANGES WITH 232 in spe
 
+        * The new RemoveIPC= option can be used to remove IPC objects owned by
+          the user or group of a service when that service exits.
+
+        * Support for dynamically creating users for the lifetime of a service
+          has been added. If DynamicUser=yes is specified, user and group IDs
+          will be allocated from the range 61184..65519 for the lifetime of the
+          service. They can be resolved using the new nss-systemd.so NSS
+          module. The module must be enabled in /etc/nsswitch.conf. Services
+          started in this way have PrivateTmp= and RemoveIPC= enabled, so that
+          any resources allocated by the service will be cleaned up when the
+          service exits.
+
+          The nss-systemd module also always resolves root and nobody, making
+          it possible to have no /etc/passwd or /etc/group files in minimal
+          container systems.
+
+        * Services may be started with their own user namespace using the new
+          PrivateUsers= option. Only root, nobody, and the uid/gid under which
+          the service is running are mapped. All other users are mapped to
+          nobody.
+
+        * Support for the cgroup namespace has been added to systemd-nspawn. If
+          supported by kernel, the container system started by systemd-nspawn
+          will have its own view of the cgroup hierarchy. This new behaviour
+          can be disabled using $SYSTEMD_NSPAWN_USE_CGNS environment variable.
+
+        * The new MemorySwapMax= option can be used to limit the maximum swap
+          usage under the unified cgroup hierarchy.
+
+        * Support for the CPU controller in the unified cgroup hierarchy has
+          been added, via the CPUWeight=, CPUStartupWeight=, CPUAccounting=
+          options. This controller requires out-of-tree patches for the kernel
+          and the support is provisional.
+
+        * .automount units may now be transient.
+
+        * systemd-mount is a new tool which wraps mount(8) to pull in
+          additional dependencies through transient .mount and .automount
+          units. For example, this automatically runs fsck on the block device
+          before mounting, and allows the automount logic to be used.
+
+        * LazyUnmount=yes option for mount units has been added to expose the
+          umount --lazy option. Similarly, ForceUnmount=yes exposes the --force
+          option.
+
+        * /efi will be used as the mount point of the EFI boot partition, if
+          the directory is present, and the mount point was not configured
+          through other means (e.g. fstab). If /efi directory does not exist,
+          /boot will be used as before. This makes it easier to automatically
+          mount the EFI partition on systems where /boot is used for something
+          else.
+
+        * disk/by-id symlinks are now created for NVMe drives.
+
+        * Two new user session targets have been added to support running
+          graphical sessions under the systemd --user instance:
+          graphical-session.target and graphical-session-pre.target. See
+          systemd.special(7) for a description of how those targets should be
+          used.
+
+        * The vconsole initialization code has been significantly reworked to
+          use KD_FONT_OP_GET/SET ioctls insteads of KD_FONT_OP_COPY and better
+          support unicode keymaps. Font and keymap configuration will now be
+          copied to all allocated virtual consoles.
+
+        * FreeBSD's bhyve virtiualization is now detected.
+
+        * Information recored in the journal for core dumps now includes the
+          contents of /proc/mountinfo and the command line of the process at
+          the top of the process hierarchy (which is usually the init process
+          of the container).
+
+        * systemd-journal-gatewayd learned the --directory option to serve
+          files from the specified location.
+
+        * journalctl --root=… can be used to peruse the journal in the
+          /var/log/ directories inside of a container tree. This is similar to
+          the existing --machine= option, but does not require the container to
+          be active.
+
+        * The hardware database has been extended to support
+          ID_INPUT_TRACKBALL, used in addition to ID_INPUT_MOUSE to identify
+          trackball devices.
+
+          MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL hwdb property has been added to
+          specify the click rate for mice which include a horizontal wheel with
+          a click rate that is different than the one for the vertical wheel.
+
+        * systemd-run gained a new --wait option that makes service execution
+          synchronous.
+
+        * A new journal output mode "short-full" has been added which uses
+          timestamps with abbreviated English day names and adds a timezone
+          suffix. Those timestamps include more information and can be parsed
+          by journalctl.
+
+        * /etc/resolv.conf will be bind-mounted into containers started by
+          systemd-nspawn, if possible, so any changes to resolv.conf contents
+          are automatically propagated to the container.
+
+        * The number of instances for socket-activated services originating
+          from a single IP can be limited with MaxConnectionsPerSource=,
+          extending the existing setting of MaxConnections.
+
+        * UDP Segmentation Offload, TCP Segmentation Offload, Generic
+          Segmentation Offload, Generic Receive Offload, Large Receive Offload
+          can be enabled and disabled using the new UDPSegmentationOffload=,
+          TCPSegmentationOffload=, GenericSegmentationOffload=,
+          GenericReceiveOffload=, LargeReceiveOffload= options in the
+          [Link] section of .link files.
+
+          Spanning Tree Protocol enablement, Priority, Aging Time, and the
+          Default Port VLAN ID can be configured for bridge devices using the
+          new STP=, Priority=, AgeingTimeSec=, and DefaultPVID= settings in the
+          [Bridge] section of .netdev files.
+
+          Address Resolution Protocol can be disabled on links managed by
+          systemd-networkd using the ARP=no setting in the [Link] section of
+          .network files.
+
+        * $SERVICE_RESULT, $EXIT_CODE, $EXIT_STATUS are set for ExecStop= and
+          ExecStopPost= commands.
+
         * Journald's SplitMode=login setting has been deprecated. It has been
           removed from documentation, and it's use is discouraged. In a future
           release it will be completely removed, and made equivalent to current
           default of SplitMode=uid.
 
+        * The --share-system systemd-nspawn option has been replaced with an
+          (undocumented) variable $SYSTEMD_NSPAWN_SHARE_SYSTEM, but the use of
+          this functionality is discouraged. In addition the variables
+          $SYSTEMD_NSPAWN_SHARE_NS_IPC, $SYSTEMD_NSPAWN_SHARE_NS_PID,
+          $SYSTEMD_NSPAWN_SHARE_NS_UTS may be used to control the unsharing of
+          individual namespaces.
+
 CHANGES WITH 231:
 
         * In service units the various ExecXYZ= settings have been extended
@@ -223,6 +353,9 @@ CHANGES WITH 231:
           local changes made to systemd in a pristine, defined environment. See
           HACKING for details.
 
+        * configure learned the --with-support-url= option to specify the
+          distribution's bugtracker.
+
         Contributions from: Alban Crequy, Alessandro Puccetti, Alessio Igor
         Bogani, Alexander Kuleshov, Alexander Kurtz, Alex Gaynor, Andika
         Triwidada, Andreas Pokorny, Andreas Rammhold, Andrew Jeddeloh, Ansgar
index f55562250d3e06a5de6d661b02da4b974fc7c42d..e163edbc51d11f0627effd5d01885d29b63ac364 100755 (executable)
@@ -1,22 +1,30 @@
 #!/usr/bin/python3
-#  -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
+# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
 #
-#  This file is part of systemd.
+# This file is part of systemd. It is distrubuted under the MIT license, see
+# below.
 #
-#  Copyright 2016 Zbigniew Jędrzejewski-Szmek
+# Copyright 2016 Zbigniew Jędrzejewski-Szmek
 #
-#  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.
+# The MIT License (MIT)
 #
-#  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.
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
 #
-#  You should have received a copy of the GNU Lesser General Public License
-#  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
 
 import functools
 import glob
index a5920e7d36bef2566b6d13d53c81eed7119eed0c..1cfb7a98f50e38eefd04e56782474ef9a073c303 100644 (file)
@@ -1043,7 +1043,7 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) {
         if (r < 0)
                 return r;
 
-        fd = mkostemp_safe(t, O_WRONLY|O_CLOEXEC);
+        fd = mkostemp_safe(t);
         if (fd < 0) {
                 free(t);
                 return -errno;
@@ -1076,7 +1076,7 @@ int fflush_and_check(FILE *f) {
 }
 
 /* This is much like mkostemp() but is subject to umask(). */
-int mkostemp_safe(char *pattern, int flags) {
+int mkostemp_safe(char *pattern) {
         _cleanup_umask_ mode_t u = 0;
         int fd;
 
@@ -1084,7 +1084,7 @@ int mkostemp_safe(char *pattern, int flags) {
 
         u = umask(077);
 
-        fd = mkostemp(pattern, flags);
+        fd = mkostemp(pattern, O_CLOEXEC);
         if (fd < 0)
                 return -errno;
 
@@ -1289,7 +1289,7 @@ int open_tmpfile_unlinkable(const char *directory, int flags) {
         /* Fall back to unguessable name + unlinking */
         p = strjoina(directory, "/systemd-tmp-XXXXXX");
 
-        fd = mkostemp_safe(p, flags);
+        fd = mkostemp_safe(p);
         if (fd < 0)
                 return fd;
 
index 9ac497d9ebccd8bf4cb6ea88a09c0651eaaba6b1..b58c83e64ad501a7322aeff754e2b9f7239cf1fd 100644 (file)
@@ -71,7 +71,7 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *root
 int fflush_and_check(FILE *f);
 
 int fopen_temporary(const char *path, FILE **_f, char **_temp_path);
-int mkostemp_safe(char *pattern, int flags);
+int mkostemp_safe(char *pattern);
 
 int tempfn_xxxxxx(const char *p, const char *extra, char **ret);
 int tempfn_random(const char *p, const char *extra, char **ret);
index bbf8793e57f841618af63cdbee5ce557ee67812a..8ba7c08eed713ba03ae666018dff96f04c6f49c8 100644 (file)
@@ -620,7 +620,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
                         if (!temp)
                                 return log_oom();
 
-                        fdt = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC);
+                        fdt = mkostemp_safe(temp);
                         if (fdt < 0)
                                 return log_error_errno(fdt, "Failed to create temporary file: %m");
                         log_debug("Created temporary file %s", temp);
index 381e21939089341f05650ff98a1125314811b3ec..31074eb5f8bf4aa584ea7ac79b5e81d7515a456c 100644 (file)
@@ -1632,7 +1632,7 @@ static int setup_keys(void) {
         n /= arg_interval;
 
         safe_close(fd);
-        fd = mkostemp_safe(k, O_WRONLY|O_CLOEXEC);
+        fd = mkostemp_safe(k);
         if (fd < 0) {
                 r = log_error_errno(fd, "Failed to open %s: %m", k);
                 goto finish;
index 898c876450cb14b5e038f3a5612e2a063cffdcf6..b7d9e7bffadf1933946d6d6a7a3302af71830d39 100644 (file)
@@ -55,7 +55,7 @@ static Hashmap * test_import(const char* contents, ssize_t size, int code) {
 
         assert_se(h = hashmap_new(&catalog_hash_ops));
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(write(fd, contents, size) == size);
 
@@ -182,7 +182,7 @@ static void test_catalog_update(void) {
         static char name[] = "/tmp/test-catalog.XXXXXX";
         int r;
 
-        r = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        r = mkostemp_safe(name);
         assert_se(r >= 0);
 
         database = name;
index 68c9a4d76c0a76a289a29ffd1f622b5b7b2187e7..00e5222a1c090440519963f714e4d86cfd0b1135 100644 (file)
@@ -167,7 +167,7 @@ static void test_compress_stream(int compression,
 
         log_debug("/* test compression */");
 
-        assert_se((dst = mkostemp_safe(pattern, O_RDWR|O_CLOEXEC)) >= 0);
+        assert_se((dst = mkostemp_safe(pattern)) >= 0);
 
         assert_se(compress(src, dst, -1) == 0);
 
@@ -178,7 +178,7 @@ static void test_compress_stream(int compression,
 
         log_debug("/* test decompression */");
 
-        assert_se((dst2 = mkostemp_safe(pattern2, O_RDWR|O_CLOEXEC)) >= 0);
+        assert_se((dst2 = mkostemp_safe(pattern2)) >= 0);
 
         assert_se(stat(srcfile, &st) == 0);
 
index 009aabf55e8e80a32f7ce29e55f75859323de844..0ad49aeb5fd5322a6294275d94b212c5b9a3728e 100644 (file)
@@ -36,15 +36,15 @@ int main(int argc, char *argv[]) {
 
         assert_se(m = mmap_cache_new());
 
-        x = mkostemp_safe(px, O_RDWR|O_CLOEXEC);
+        x = mkostemp_safe(px);
         assert_se(x >= 0);
         unlink(px);
 
-        y = mkostemp_safe(py, O_RDWR|O_CLOEXEC);
+        y = mkostemp_safe(py);
         assert_se(y >= 0);
         unlink(py);
 
-        z = mkostemp_safe(pz, O_RDWR|O_CLOEXEC);
+        z = mkostemp_safe(pz);
         assert_se(z >= 0);
         unlink(pz);
 
index c66bcfc092d31b11ef8895fdcb77564db96ccd5d..f37c023c6ae06225a8422827395f89a5aab4710f 100644 (file)
@@ -61,6 +61,13 @@ for i in "$@"; do
     fi
 done
 
+# KERNEL_INSTALL_NOOP may be used by programs like lorax and rpm-ostree which
+# want to install a kernel (indirectly via RPM), but control generation of the
+# initramfs.  In general, OSTree takes over kernel management too.
+if test -n "${KERNEL_INSTALL_NOOP:-}"; then
+    exit 0
+fi
+
 if [[ "${0##*/}" == 'installkernel' ]]; then
     COMMAND='add'
 else
index 65151b19a6ed7b2ac7db4f7572ac6e593b0ddf03..2597cfc6486af048f15dd8cac5eb756efa65471c 100644 (file)
@@ -484,7 +484,7 @@ int ask_password_agent(
 
         (void) mkdir_p_label("/run/systemd/ask-password", 0755);
 
-        fd = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC);
+        fd = mkostemp_safe(temp);
         if (fd < 0) {
                 r = fd;
                 goto finish;
index 430dda8e78077792cf10a6b93c3df3dd3394ec0a..5b572bb0bfe4febc17ae4a9ae6df7e45e0b3c992 100644 (file)
@@ -35,7 +35,7 @@ static void test_add_acls_for_user(void) {
         uid_t uid;
         int r;
 
-        fd = mkostemp_safe(fn, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(fn);
         assert_se(fd >= 0);
 
         /* Use the mode that user journal files use */
index ada6d67c424b5605e476a1385269c5558571d48d..4ebc27f0bd04a8dd5055ee2e3add6d6ba5838c13 100644 (file)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
         int fd;
         char name[] = "/tmp/test-asynchronous_close.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         asynchronous_close(fd);
 
index 84f775e5bc2cbdd10d90f76a325eb8c3e6946a54..7d97328416b433ffa49382883c3d5d94e6bae4cc 100644 (file)
@@ -55,7 +55,7 @@ static void test_clock_is_localtime(void) {
         /* without an adjtime file we default to UTC */
         assert_se(clock_is_localtime("/nonexisting/adjtime") == 0);
 
-        fd = mkostemp_safe(adjtime, O_WRONLY|O_CLOEXEC);
+        fd = mkostemp_safe(adjtime);
         assert_se(fd >= 0);
         log_info("adjtime test file: %s", adjtime);
         f = fdopen(fd, "w");
index 68154fc4e82efa40b06eb3ece23367554fb933bb..ed1ea51dbd64acbdc3e1f762564b1b7993b858a2 100644 (file)
@@ -42,11 +42,11 @@ static void test_copy_file(void) {
 
         log_info("%s", __func__);
 
-        fd = mkostemp_safe(fn, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(fn);
         assert_se(fd >= 0);
         close(fd);
 
-        fd = mkostemp_safe(fn_copy, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(fn_copy);
         assert_se(fd >= 0);
         close(fd);
 
@@ -71,9 +71,9 @@ static void test_copy_file_fd(void) {
 
         log_info("%s", __func__);
 
-        in_fd = mkostemp_safe(in_fn, O_RDWR);
+        in_fd = mkostemp_safe(in_fn);
         assert_se(in_fd >= 0);
-        out_fd = mkostemp_safe(out_fn, O_RDWR);
+        out_fd = mkostemp_safe(out_fn);
         assert_se(out_fd >= 0);
 
         assert_se(write_string_file(in_fn, text, WRITE_STRING_FILE_CREATE) == 0);
@@ -207,10 +207,10 @@ static void test_copy_bytes_regular_file(const char *src, bool try_reflink, uint
         fd = open(src, O_RDONLY | O_CLOEXEC | O_NOCTTY);
         assert_se(fd >= 0);
 
-        fd2 = mkostemp_safe(fn2, O_RDWR);
+        fd2 = mkostemp_safe(fn2);
         assert_se(fd2 >= 0);
 
-        fd3 = mkostemp_safe(fn3, O_WRONLY);
+        fd3 = mkostemp_safe(fn3);
         assert_se(fd3 >= 0);
 
         r = copy_bytes(fd, fd2, max_bytes, try_reflink);
index 421d3bdeb333392f53d3ab202770ddbeb5c2a4e4..f555bb976ccc31c8c407d64fe80640ade9740b7a 100644 (file)
@@ -31,9 +31,9 @@ static void test_close_many(void) {
         char name1[] = "/tmp/test-close-many.XXXXXX";
         char name2[] = "/tmp/test-close-many.XXXXXX";
 
-        fds[0] = mkostemp_safe(name0, O_RDWR|O_CLOEXEC);
-        fds[1] = mkostemp_safe(name1, O_RDWR|O_CLOEXEC);
-        fds[2] = mkostemp_safe(name2, O_RDWR|O_CLOEXEC);
+        fds[0] = mkostemp_safe(name0);
+        fds[1] = mkostemp_safe(name1);
+        fds[2] = mkostemp_safe(name2);
 
         close_many(fds, 2);
 
@@ -52,7 +52,7 @@ static void test_close_nointr(void) {
         char name[] = "/tmp/test-test-close_nointr.XXXXXX";
         int fd;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(close_nointr(fd) >= 0);
         assert_se(close_nointr(fd) < 0);
index 282aab12460b3156cf212b7ac1426b77add7b3d0..adbf99a7ec14bbbca8db961570f752c654905e00 100644 (file)
@@ -31,7 +31,7 @@ static void test_fdset_new_fill(void) {
         _cleanup_fdset_free_ FDSet *fdset = NULL;
         char name[] = "/tmp/test-fdset_new_fill.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(fdset_new_fill(&fdset) >= 0);
         assert_se(fdset_contains(fdset, fd));
@@ -45,7 +45,7 @@ static void test_fdset_put_dup(void) {
         _cleanup_fdset_free_ FDSet *fdset = NULL;
         char name[] = "/tmp/test-fdset_put_dup.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
 
         fdset = fdset_new();
@@ -64,7 +64,7 @@ static void test_fdset_cloexec(void) {
         int flags = -1;
         char name[] = "/tmp/test-fdset_cloexec.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
 
         fdset = fdset_new();
@@ -91,7 +91,7 @@ static void test_fdset_close_others(void) {
         int flags = -1;
         char name[] = "/tmp/test-fdset_close_others.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
 
         fdset = fdset_new();
@@ -113,7 +113,7 @@ static void test_fdset_remove(void) {
         FDSet *fdset = NULL;
         char name[] = "/tmp/test-fdset_remove.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
 
         fdset = fdset_new();
@@ -136,7 +136,7 @@ static void test_fdset_iterate(void) {
         int c = 0;
         int a;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
 
         fdset = fdset_new();
@@ -161,7 +161,7 @@ static void test_fdset_isempty(void) {
         _cleanup_fdset_free_ FDSet *fdset = NULL;
         char name[] = "/tmp/test-fdset_isempty.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
 
         fdset = fdset_new();
@@ -179,7 +179,7 @@ static void test_fdset_steal_first(void) {
         _cleanup_fdset_free_ FDSet *fdset = NULL;
         char name[] = "/tmp/test-fdset_steal_first.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
 
         fdset = fdset_new();
index 79609765e0e80e99fe82f8108f5bdc5bf7174894..92663ef66f0649640380236c7068258c9eb9cb45 100644 (file)
@@ -45,11 +45,11 @@ static void test_parse_env_file(void) {
         char **i;
         unsigned k;
 
-        fd = mkostemp_safe(p, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(p);
         assert_se(fd >= 0);
         close(fd);
 
-        fd = mkostemp_safe(t, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(t);
         assert_se(fd >= 0);
 
         f = fdopen(fd, "w");
@@ -158,11 +158,11 @@ static void test_parse_multiline_env_file(void) {
         _cleanup_strv_free_ char **a = NULL, **b = NULL;
         char **i;
 
-        fd = mkostemp_safe(p, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(p);
         assert_se(fd >= 0);
         close(fd);
 
-        fd = mkostemp_safe(t, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(t);
         assert_se(fd >= 0);
 
         f = fdopen(fd, "w");
@@ -211,7 +211,7 @@ static void test_executable_is_script(void) {
         FILE *f;
         char *command;
 
-        fd = mkostemp_safe(t, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(t);
         assert_se(fd >= 0);
 
         f = fdopen(fd, "w");
@@ -300,7 +300,7 @@ static void test_write_string_stream(void) {
         int fd;
         char buf[64];
 
-        fd = mkostemp_safe(fn, O_RDWR);
+        fd = mkostemp_safe(fn);
         assert_se(fd >= 0);
 
         f = fdopen(fd, "r");
@@ -334,7 +334,7 @@ static void test_write_string_file(void) {
         char buf[64] = {};
         _cleanup_close_ int fd;
 
-        fd = mkostemp_safe(fn, O_RDWR);
+        fd = mkostemp_safe(fn);
         assert_se(fd >= 0);
 
         assert_se(write_string_file(fn, "boohoo", WRITE_STRING_FILE_CREATE) == 0);
@@ -350,7 +350,7 @@ static void test_write_string_file_no_create(void) {
         _cleanup_close_ int fd;
         char buf[64] = {0};
 
-        fd = mkostemp_safe(fn, O_RDWR);
+        fd = mkostemp_safe(fn);
         assert_se(fd >= 0);
 
         assert_se(write_string_file("/a/file/which/does/not/exists/i/guess", "boohoo", 0) < 0);
@@ -390,7 +390,7 @@ static void test_load_env_file_pairs(void) {
         _cleanup_strv_free_ char **l = NULL;
         char **k, **v;
 
-        fd = mkostemp_safe(fn, O_RDWR);
+        fd = mkostemp_safe(fn);
         assert_se(fd >= 0);
 
         r = write_string_file(fn,
@@ -433,7 +433,7 @@ static void test_search_and_fopen(void) {
         int r;
         FILE *f;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         close(fd);
 
@@ -469,7 +469,7 @@ static void test_search_and_fopen_nulstr(void) {
         int r;
         FILE *f;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         close(fd);
 
@@ -504,7 +504,7 @@ static void test_writing_tmpfile(void) {
         IOVEC_SET_STRING(iov[1], ALPHANUMERICAL "\n");
         IOVEC_SET_STRING(iov[2], "");
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         printf("tmpfile: %s", name);
 
         r = writev(fd, iov, 3);
index b3c4a2a2eb80936e5b00ccbe3306a0da94434a18..b35a2ea2c81354bf17d7f4dfffc3280a37368218 100644 (file)
@@ -34,7 +34,7 @@ static void test_unlink_noerrno(void) {
         char name[] = "/tmp/test-close_nointr.XXXXXX";
         int fd;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(close_nointr(fd) >= 0);
 
index 227d4290f0694a09f7d6c9eff2e3e28280fce0c8..9eea3eb608bf36925ccb176dc5dd9cf39088a207 100644 (file)
@@ -30,7 +30,7 @@ static void test_glob_exists(void) {
         int fd = -1;
         int r;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         close(fd);
 
index 1c3d13ed1d79a07628744bcb3e3d53c10a27b2b6..d2c3ea5e0d0189769a2ba24969438e113829e711 100644 (file)
@@ -104,7 +104,7 @@ static void test_read_hostname_config(void) {
         char *hostname;
         int fd;
 
-        fd = mkostemp_safe(path, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(path);
         assert(fd > 0);
         close(fd);
 
index a10227f8235adb5e0b8ddab5d7f48856a3ffc9bc..6c34250a01c835aa3dde6f1d2ca561cdf8bb6636 100644 (file)
@@ -31,7 +31,7 @@ static void test_files_same(void) {
         char name[] = "/tmp/test-files_same.XXXXXX";
         char name_alias[] = "/tmp/test-files_same.alias";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(symlink(name, name_alias) >= 0);
 
@@ -47,7 +47,7 @@ static void test_is_symlink(void) {
         char name_link[] = "/tmp/test-is_symlink.link";
         _cleanup_close_ int fd = -1;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(symlink(name, name_link) >= 0);
 
index 84b448a0957a39a62e81d0192204af54d09192bf..373a1b70ba0038e020de1f5038e3490ef0dc5c77 100644 (file)
@@ -50,7 +50,7 @@ static void test_read_one_char(void) {
         char name[] = "/tmp/test-read_one_char.XXXXXX";
         int fd;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         file = fdopen(fd, "r+");
         assert_se(file);
index b34ebeefb24a12e1dcde2ad5d7813e9481e82f02..f35e6793b78bec8df52e962841a8c8edff8d1c9d 100644 (file)
@@ -51,7 +51,7 @@ int main(int argc, char** argv) {
         log_debug("link1: %s", ans);
         assert_se(endswith(ans, " (deleted)"));
 
-        fd2 = mkostemp_safe(pattern, O_RDWR|O_CLOEXEC);
+        fd2 = mkostemp_safe(pattern);
         assert_se(fd >= 0);
         assert_se(unlink(pattern) == 0);
 
index a5009f98ef02e62be2f805ce1360177a0f097e8e..7ef087a2e360aa7015af67d50944e972a09cec8a 100644 (file)
@@ -485,7 +485,7 @@ static void test_load_env_file_1(void) {
         char name[] = "/tmp/test-load-env-file.XXXXXX";
         _cleanup_close_ int fd;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(write(fd, env_file_1, sizeof(env_file_1)) == sizeof(env_file_1));
 
@@ -508,7 +508,7 @@ static void test_load_env_file_2(void) {
         char name[] = "/tmp/test-load-env-file.XXXXXX";
         _cleanup_close_ int fd;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(write(fd, env_file_2, sizeof(env_file_2)) == sizeof(env_file_2));
 
@@ -526,7 +526,7 @@ static void test_load_env_file_3(void) {
         char name[] = "/tmp/test-load-env-file.XXXXXX";
         _cleanup_close_ int fd;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(write(fd, env_file_3, sizeof(env_file_3)) == sizeof(env_file_3));
 
@@ -542,7 +542,7 @@ static void test_load_env_file_4(void) {
         _cleanup_close_ int fd;
         int r;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(write(fd, env_file_4, sizeof(env_file_4)) == sizeof(env_file_4));
 
@@ -562,7 +562,7 @@ static void test_load_env_file_5(void) {
         char name[] = "/tmp/test-load-env-file.XXXXXX";
         _cleanup_close_ int fd;
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         assert_se(write(fd, env_file_5, sizeof(env_file_5)) == sizeof(env_file_5));