diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-22 17:04:29 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-03-22 20:30:40 +0100 |
commit | c10d6bdb891881f68471dabd8100ea6021e6cdbb (patch) | |
tree | 99f77908217b88a1b49c1ef23d1e27c493ba30e4 /src/import/import-raw.c | |
parent | sleep-config: replace USE() macro with TAKE_PTR() usage (diff) | |
download | systemd-c10d6bdb891881f68471dabd8100ea6021e6cdbb.tar.xz systemd-c10d6bdb891881f68471dabd8100ea6021e6cdbb.zip |
macro: introduce new TAKE_FD() macro
This is similar to TAKE_PTR() but operates on file descriptors, and thus
assigns -1 to the fd parameter after returning it.
Removes 60 lines from our codebase. Pretty good too I think.
Diffstat (limited to 'src/import/import-raw.c')
-rw-r--r-- | src/import/import-raw.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/import/import-raw.c b/src/import/import-raw.c index f117c94da2..032b3dcda2 100644 --- a/src/import/import-raw.c +++ b/src/import/import-raw.c @@ -210,8 +210,7 @@ static int raw_import_maybe_convert_qcow2(RawImport *i) { free_and_replace(i->temp_path, t); safe_close(i->output_fd); - i->output_fd = converted_fd; - converted_fd = -1; + i->output_fd = TAKE_FD(converted_fd); return 1; } |