*: 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:
@@ -791,14 +791,12 @@ int ask_password_agent(
|
||||
|
||||
(void) fchmod(fd, 0644);
|
||||
|
||||
f = fdopen(fd, "w");
|
||||
f = take_fdopen(&fd, "w");
|
||||
if (!f) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
fd = -1;
|
||||
|
||||
signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
|
||||
if (signal_fd < 0) {
|
||||
r = -errno;
|
||||
|
||||
@@ -1541,14 +1541,12 @@ int dissected_image_acquire_metadata(DissectedImage *m) {
|
||||
|
||||
fds[2*k+1] = safe_close(fds[2*k+1]);
|
||||
|
||||
f = fdopen(fds[2*k], "r");
|
||||
f = take_fdopen(&fds[2*k], "r");
|
||||
if (!f) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
fds[2*k] = -1;
|
||||
|
||||
switch (k) {
|
||||
|
||||
case META_HOSTNAME:
|
||||
|
||||
@@ -1280,10 +1280,9 @@ static int unit_file_load(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
f = fdopen(fd, "r");
|
||||
f = take_fdopen(&fd, "r");
|
||||
if (!f)
|
||||
return -errno;
|
||||
fd = -1;
|
||||
|
||||
/* c is only needed if we actually load the file (it's referenced from items[] btw, in case you wonder.) */
|
||||
assert(c);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "env-file.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
#include "macro.h"
|
||||
#include "os-util.h"
|
||||
@@ -76,10 +77,9 @@ int fopen_os_release(const char *root, char **ret_path, FILE **ret_file) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
f = fdopen(fd, "r");
|
||||
f = take_fdopen(&fd, "r");
|
||||
if (!f)
|
||||
return -errno;
|
||||
fd = -1;
|
||||
|
||||
*ret_file = f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user