systemd: merge branch systemd into master

This commit is contained in:
Thomas Haller
2020-04-08 09:03:31 +02:00
22 changed files with 359 additions and 58 deletions

View File

@@ -50,14 +50,12 @@ int fopen_temporary(const char *path, FILE **ret_f, char **ret_temp_path) {
/* This assumes that returned FILE object is short-lived and used within the same single-threaded
* context and never shared externally, hence locking is not necessary. */
r = fdopen_unlocked(fd, "w", &f);
r = take_fdopen_unlocked(&fd, "w", &f);
if (r < 0) {
(void) unlink(t);
return r;
}
TAKE_FD(fd);
if (ret_f)
*ret_f = TAKE_PTR(f);
@@ -83,18 +81,16 @@ int mkostemp_safe(char *pattern) {
#if 0 /* NM_IGNORED */
int fmkostemp_safe(char *pattern, const char *mode, FILE **ret_f) {
int fd;
_cleanup_close_ int fd = -1;
FILE *f;
fd = mkostemp_safe(pattern);
if (fd < 0)
return fd;
f = fdopen(fd, mode);
if (!f) {
safe_close(fd);
f = take_fdopen(&fd, mode);
if (!f)
return -errno;
}
*ret_f = f;
return 0;