mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 17:10:08 +01:00
systemd: merge branch systemd into master
This commit is contained in:
commit
ee723b2aee
3 changed files with 5 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ char* hostname_cleanup(char *s) {
|
|||
*(d++) = *p;
|
||||
dot = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (dot && d > s)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue