<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2011 Lennart Poettering
-->
<?xml version='1.0'?> <!--*-nxml-*-->
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2017 Lennart Poettering
-->
<refentry id="elogind-rc-local-generator">
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2018 Peter A. Bigot
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2016 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2010 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2016 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2016 Julian Orth
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2016 Julian Orth
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2017 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2013 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2013 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2016 Julian Orth
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2016 Julian Orth
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2017 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2017 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2017 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2015 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2015 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2015 Zbigniew Jędrzejewski-Szmek
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2010 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2012 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2012 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2012 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2014 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2010 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2010 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
-->
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
- This file is part of elogind.
SPDX-License-Identifier: LGPL-2.1+
-
Copyright 2013 Lennart Poettering
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
-->
<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of elogind.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
Copyright 2014 Lennart Poettering
-->
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010-2012 Lennart Poettering
Copyright 2010-2012 Kay Sievers
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
#include "io-util.h"
//#include "macro.h"
#include "missing.h"
+//#include "mount-util.h"
//#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "user-util.h"
//#include "xattr-util.h"
-#define COPY_BUFFER_SIZE (16*1024u)
+#define COPY_BUFFER_SIZE (16U*1024U)
+
+/* A safety net for descending recursively into file system trees to copy. On Linux PATH_MAX is 4096, which means the
+ * deepest valid path one can build is around 2048, which we hence use as a safety net here, to not spin endlessly in
+ * case of bind mount cycles and suchlike. */
+#define COPY_DEPTH_MAX 2048U
static ssize_t try_copy_file_range(
int fd_in, loff_t *off_in,
int dt,
const char *to,
dev_t original_device,
+ unsigned depth_left,
uid_t override_uid,
gid_t override_gid,
CopyFlags copy_flags) {
assert(st);
assert(to);
+ if (depth_left == 0)
+ return -ENAMETOOLONG;
+
if (from)
fdf = openat(df, from, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
else
continue;
}
- if (buf.st_dev != original_device)
- continue;
+ if (S_ISDIR(buf.st_mode)) {
+ /*
+ * Don't descend into directories on other file systems, if this is requested. We do a simple
+ * .st_dev check here, which basically comes for free. Note that we do this check only on
+ * directories, not other kind of file system objects, for two reason:
+ *
+ * • The kernel's overlayfs pseudo file system that overlays multiple real file systems
+ * propagates the .st_dev field of the file system a file originates from all the way up
+ * through the stack to stat(). It doesn't do that for directories however. This means that
+ * comparing .st_dev on non-directories suggests that they all are mount points. To avoid
+ * confusion we hence avoid relying on this check for regular files.
+ *
+ * • The main reason we do this check at all is to protect ourselves from bind mount cycles,
+ * where we really want to avoid descending down in all eternity. However the .st_dev check
+ * is usually not sufficient for this protection anyway, as bind mount cycles from the same
+ * file system onto itself can't be detected that way. (Note we also do a recursion depth
+ * check, which is probably the better protection in this regard, which is why
+ * COPY_SAME_MOUNT is optional).
+ */
+
+ if (FLAGS_SET(copy_flags, COPY_SAME_MOUNT)) {
+ if (buf.st_dev != original_device)
+ continue;
+
+ r = fd_is_mount_point(dirfd(d), de->d_name, 0);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ continue;
+ }
- if (S_ISREG(buf.st_mode))
+ q = fd_copy_directory(dirfd(d), de->d_name, &buf, fdt, de->d_name, original_device, depth_left-1, override_uid, override_gid, copy_flags);
+ } else if (S_ISREG(buf.st_mode))
q = fd_copy_regular(dirfd(d), de->d_name, &buf, fdt, de->d_name, override_uid, override_gid, copy_flags);
- else if (S_ISDIR(buf.st_mode))
- q = fd_copy_directory(dirfd(d), de->d_name, &buf, fdt, de->d_name, original_device, override_uid, override_gid, copy_flags);
else if (S_ISLNK(buf.st_mode))
q = fd_copy_symlink(dirfd(d), de->d_name, &buf, fdt, de->d_name, override_uid, override_gid, copy_flags);
else if (S_ISFIFO(buf.st_mode))
if (S_ISREG(st.st_mode))
return fd_copy_regular(fdf, from, &st, fdt, to, override_uid, override_gid, copy_flags);
else if (S_ISDIR(st.st_mode))
- return fd_copy_directory(fdf, from, &st, fdt, to, st.st_dev, override_uid, override_gid, copy_flags);
+ return fd_copy_directory(fdf, from, &st, fdt, to, st.st_dev, COPY_DEPTH_MAX, override_uid, override_gid, copy_flags);
else if (S_ISLNK(st.st_mode))
return fd_copy_symlink(fdf, from, &st, fdt, to, override_uid, override_gid, copy_flags);
else if (S_ISFIFO(st.st_mode))
if (!S_ISDIR(st.st_mode))
return -ENOTDIR;
- return fd_copy_directory(dirfd, NULL, &st, AT_FDCWD, to, st.st_dev, UID_INVALID, GID_INVALID, copy_flags);
+ return fd_copy_directory(dirfd, NULL, &st, AT_FDCWD, to, st.st_dev, COPY_DEPTH_MAX, UID_INVALID, GID_INVALID, copy_flags);
}
int copy_directory(const char *from, const char *to, CopyFlags copy_flags) {
if (!S_ISDIR(st.st_mode))
return -ENOTDIR;
- return fd_copy_directory(AT_FDCWD, from, &st, AT_FDCWD, to, st.st_dev, UID_INVALID, GID_INVALID, copy_flags);
+ return fd_copy_directory(AT_FDCWD, from, &st, AT_FDCWD, to, st.st_dev, COPY_DEPTH_MAX, UID_INVALID, GID_INVALID, copy_flags);
}
int copy_file_fd(const char *from, int fdt, CopyFlags copy_flags) {
}
int copy_file_atomic(const char *from, const char *to, mode_t mode, unsigned chattr_flags, CopyFlags copy_flags) {
- _cleanup_(unlink_and_freep) char *t = NULL;
- _cleanup_close_ int fdt = -1;
+ _cleanup_free_ char *t = NULL;
int r;
assert(from);
assert(to);
- /* 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;
- }
-
- if (chattr_flags != 0)
- (void) chattr_fd(fdt, chattr_flags, (unsigned) -1);
-
- r = copy_file_fd(from, fdt, copy_flags);
+ r = tempfn_random(to, NULL, &t);
if (r < 0)
return r;
- if (fchmod(fdt, mode) < 0)
- return -errno;
+ r = copy_file(from, t, O_NOFOLLOW|O_EXCL, mode, chattr_flags, copy_flags);
+ if (r < 0)
+ return r;
if (copy_flags & COPY_REPLACE) {
- if (renameat(AT_FDCWD, t, AT_FDCWD, to) < 0)
- return -errno;
- } else {
- r = link_tmpfile(fdt, t, to);
+ r = renameat(AT_FDCWD, t, AT_FDCWD, to);
if (r < 0)
- return r;
+ r = -errno;
+ } else
+ r = rename_noreplace(AT_FDCWD, t, AT_FDCWD, to);
+ if (r < 0) {
+ (void) unlink(t);
+ return r;
}
- t = mfree(t);
return 0;
}
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010-2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2017 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2010 Harald Hoyer
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2010 Harald Hoyer
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
}
int mkdtemp_malloc(const char *template, char **ret) {
- _cleanup_free_ char *p = NULL;
- int r;
+ char *p;
+ assert(template);
assert(ret);
- if (template)
- p = strdup(template);
- else {
- const char *tmp;
-
- r = tmp_dir(&tmp);
- if (r < 0)
- return r;
-
- p = strjoin(tmp, "/XXXXXX");
- }
+ p = strdup(template);
if (!p)
return -ENOMEM;
- if (!mkdtemp(p))
+ if (!mkdtemp(p)) {
+ free(p);
return -errno;
+ }
- *ret = TAKE_PTR(p);
+ *ret = p;
return 0;
}
#endif // 0
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2015 Ronny Chevalier
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
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;
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#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);
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2014 Michal Schmidt
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2014 Michal Schmidt
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2014 Michal Schmidt
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2014 Michal Schmidt
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010-2015 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010-2014 Lennart Poettering
Copyright 2014 Michal Schmidt
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011-2014 Lennart Poettering
Copyright 2014 Michal Schmidt
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2016 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2013 Kay Sievers
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2013 Kay Sievers
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010-2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010-2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2016 Michael Karcher
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010-2015 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Intel Corporation
Author: Auke Kok <auke-jan.h.kok@intel.com>
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Intel Corporation
Author: Auke Kok <auke-jan.h.kok@intel.com>
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010-2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010-2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Tom Gundersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2008-2011 Kay Sievers
Copyright 2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/***
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
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
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
-
- 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.
-
- elogind 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/>.
***/
#include <unistd.h>
#pragma once
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 David Herrmann
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 David Herrmann
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Daniel Mack
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/***
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
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
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011,2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
//#include "rlimit-util.h"
//#include "rlimit-util.h"
//#include "rlimit-util.h"
+//#include "rlimit-util.h"
int config_item_table_lookup(
const void *table,
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
Copyright 2018 Dell Inc.
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
#if 0 /// UNNEEDED by elogind
+//#include <linux/fiemap.h>
//#include "time-util.h"
+int read_fiemap(int fd, struct fiemap **ret);
int parse_sleep_config(const char *verb, char ***modes, char ***states, usec_t *delay);
+int find_hibernate_location(char **device, char **type, size_t *size, size_t *used);
int can_sleep(const char *verb);
int can_sleep_disk(char **types);
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2017 Zbigniew Jędrzejewski-Szmek
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
Copyright 2013 Zbigniew Jędrzejewski-Szmek
Copyright 2010-2017 Canonical
#define foosdcommonhfoo
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosdbusprotocolhfoo
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosdbusvtablehfoo
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosdbushfoo
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosddaemonhfoo
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosdeventhfoo
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosdid128hfoo
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosdloginhfoo
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
#define foosdmessageshfoo
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Michael Marineau
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Ronny Chevalier
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2014 Ronny Chevalier
***/
unlink(fn3);
}
-static void test_copy_atomic(void) {
- _cleanup_(rm_rf_physical_and_freep) char *p = NULL;
- const char *q;
- int r;
-
- assert_se(mkdtemp_malloc(NULL, &p) >= 0);
-
- q = strjoina(p, "/fstab");
-
- r = copy_file_atomic("/etc/fstab", q, 0644, 0, COPY_REFLINK);
- if (r == -ENOENT)
- return;
-
- assert_se(copy_file_atomic("/etc/fstab", q, 0644, 0, COPY_REFLINK) == -EEXIST);
-
- assert_se(copy_file_atomic("/etc/fstab", q, 0644, 0, COPY_REPLACE) >= 0);
-}
-
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
#if 0 /// UNNEEDED by elogind
test_copy_file();
test_copy_bytes_regular_file(argv[0], true, 1000);
test_copy_bytes_regular_file(argv[0], false, 32000); /* larger than copy buffer size */
test_copy_bytes_regular_file(argv[0], true, 32000);
- test_copy_atomic();
return 0;
}
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Shawn Landden
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2013 Thomas H.P. Andersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2013 Thomas H.P. Andersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2013 Daniel Buch
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2013 Daniel Buch
***/
#pragma once
/***
- This file is part of systemd.
-
Copyright 2013 Holger Hans Peter Freyther
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2011 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2013 Jan Janssen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2014 Ronny Chevalier
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2013 Thomas H.P. Andersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2013 Thomas H.P. Andersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2017 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2014 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Lennart Poettering
***/
//#include "string-util.h"
//#include "stdio-util.h"
//#include "string-util.h"
+//#include "stdio-util.h"
+//#include "string-util.h"
#include "process-util.h"
#define info(sig) log_info(#sig " = " STRINGIFY(sig) " = %d", sig)
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Tom Gundersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2016 Zbigniew Jędrzejewski-Szmek
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2012 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd
-
Copyright 2014 Tom Gundersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2015 Lennart Poettering
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2013 Dave Reisner
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
Copyright 2013 Thomas H.P. Andersen
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2014 systemd developers
***/
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1+
#
-# This file is part of elogind.
-#
# Copyright 2014 Michal Schmidt
import gdb
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1+
#
-# This file is part of elogind.
-#
# Copyright 2012-2013 Zbigniew Jędrzejewski-Szmek
import sys
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1+
#
-# This file is part of elogind.
-#
# Copyright 2012 Lennart Poettering
# Copyright 2013 Zbigniew Jędrzejewski-Szmek
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1+
#
-# This file is part of systemd.
-#
# Copyright 2013, 2017 Zbigniew Jędrzejewski-Szmek
from __future__ import print_function
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1+
#
-# This file is part of systemd.
-#
# Copyright 2012-2013 Zbigniew Jędrzejewski-Szmek
from lxml import etree as tree