diff options
author | Thomas Haller <thaller@redhat.com> | 2016-09-07 13:38:36 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-09-07 13:38:37 +0200 |
commit | ee723b2aee3dad18207cbc4083bb290da1f2a3e8 (patch) | |
tree | d55a317eb1e921f34539718b547909abbe0c2bed | |
parent | 0ef8e98e73c057ff542501cd548488a170430667 (diff) | |
parent | a1efdc2b0ae5fe30716119bd052b95988d81eb20 (diff) | |
download | NetworkManager-ee723b2aee3dad18207cbc4083bb290da1f2a3e8.tar.gz |
systemd: merge branch systemd into master
-rw-r--r-- | src/systemd/src/basic/fileio.c | 5 | ||||
-rw-r--r-- | src/systemd/src/basic/hostname-util.c | 1 | ||||
-rw-r--r-- | src/systemd/src/basic/string-util.h | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/systemd/src/basic/fileio.c b/src/systemd/src/basic/fileio.c index b2fe15ca28..b4869da3d3 100644 --- a/src/systemd/src/basic/fileio.c +++ b/src/systemd/src/basic/fileio.c @@ -39,6 +39,7 @@ #include "hexdecoct.h" #include "log.h" #include "macro.h" +#include "missing.h" #include "parse-util.h" #include "path-util.h" #include "random-util.h" @@ -1287,12 +1288,10 @@ int open_tmpfile_unlinkable(const char *directory, int flags) { /* Returns an unlinked temporary file that cannot be linked into the file system anymore */ -#ifdef O_TMPFILE /* Try O_TMPFILE first, if it is supported */ fd = open(directory, flags|O_TMPFILE|O_EXCL, S_IRUSR|S_IWUSR); if (fd >= 0) return fd; -#endif /* Fall back to unguessable name + unlinking */ p = strjoina(directory, "/systemd-tmp-XXXXXX"); @@ -1320,7 +1319,6 @@ int open_tmpfile_linkable(const char *target, int flags, char **ret_path) { * which case "ret_path" will be returned as NULL. If not possible a the tempoary path name used is returned in * "ret_path". Use link_tmpfile() below to rename the result after writing the file in full. */ -#ifdef O_TMPFILE { _cleanup_free_ char *dn = NULL; @@ -1336,7 +1334,6 @@ int open_tmpfile_linkable(const char *target, int flags, char **ret_path) { log_debug_errno(errno, "Failed to use O_TMPFILE on %s: %m", dn); } -#endif r = tempfn_random(target, NULL, &tmp); if (r < 0) diff --git a/src/systemd/src/basic/hostname-util.c b/src/systemd/src/basic/hostname-util.c index 480f9d9de6..732a0ce78b 100644 --- a/src/systemd/src/basic/hostname-util.c +++ b/src/systemd/src/basic/hostname-util.c @@ -165,7 +165,6 @@ char* hostname_cleanup(char *s) { *(d++) = *p; dot = false; } - } if (dot && d > s) diff --git a/src/systemd/src/basic/string-util.h b/src/systemd/src/basic/string-util.h index b75aba63c2..d029d538bd 100644 --- a/src/systemd/src/basic/string-util.h +++ b/src/systemd/src/basic/string-util.h @@ -70,6 +70,10 @@ static inline const char *empty_to_null(const char *p) { return isempty(p) ? NULL : p; } +static inline const char *strdash_if_empty(const char *str) { + return isempty(str) ? "-" : str; +} + static inline char *startswith(const char *s, const char *prefix) { size_t l; |