*: convert amenable fdopen calls to take_fdopen

Mechanical change to eliminate some cruft by using the
new take_fdopen{_unlocked}() wrappers where trivial.
This commit is contained in:
Vito Caputo
2020-03-31 06:48:03 -07:00
parent 3ebbb6cb39
commit 4fa744a35c
12 changed files with 16 additions and 37 deletions
+2 -3
View File
@@ -20,6 +20,7 @@
#include "env-file.h"
#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "in-addr-util.h"
@@ -399,12 +400,10 @@ int bus_machine_method_get_os_release(sd_bus_message *message, void *userdata, s
pair[1] = safe_close(pair[1]);
f = fdopen(pair[0], "r");
f = take_fdopen(&pair[0], "r");
if (!f)
return -errno;
pair[0] = -1;
r = load_env_file_pairs(f, "/etc/os-release", &l);
if (r < 0)
return r;
+1 -3
View File
@@ -620,12 +620,10 @@ static int clean_pool_done(Operation *operation, int ret, sd_bus_error *error) {
if (lseek(operation->extra_fd, 0, SEEK_SET) == (off_t) -1)
return -errno;
f = fdopen(operation->extra_fd, "r");
f = take_fdopen(&operation->extra_fd, "r");
if (!f)
return -errno;
operation->extra_fd = -1;
/* The resulting temporary file starts with a boolean value that indicates success or not. */
errno = 0;
n = fread(&success, 1, sizeof(success), f);