mirror of
https://github.com/systemd/systemd.git
synced 2025-03-13 00:58:27 +03:00
fd-util: rename CLOSE_AND_REPLACE() -> close_and_replace()
We have free_and_replace() and friends, they are all named with lower letters, even they are macros, not functions. For consistency, let's rename CLOSE_AND_REPLACE() with lower letters. This also mekes the macro used more places.
This commit is contained in:
parent
cb19517490
commit
ee3455cf11
@ -265,8 +265,7 @@ int chase_symlinks(
|
||||
previous_stat = st;
|
||||
}
|
||||
|
||||
safe_close(fd);
|
||||
fd = TAKE_FD(fd_parent);
|
||||
close_and_replace(fd, fd_parent);
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -362,8 +361,7 @@ int chase_symlinks(
|
||||
return -ENOMEM;
|
||||
|
||||
/* And iterate again, but go one directory further down. */
|
||||
safe_close(fd);
|
||||
fd = TAKE_FD(child);
|
||||
close_and_replace(fd, child);
|
||||
}
|
||||
|
||||
if (ret_path)
|
||||
|
@ -654,7 +654,7 @@ int rearrange_stdio(int original_input_fd, int original_output_fd, int original_
|
||||
goto finish;
|
||||
}
|
||||
|
||||
CLOSE_AND_REPLACE(null_fd, copy);
|
||||
close_and_replace(null_fd, copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ static inline int make_null_stdio(void) {
|
||||
})
|
||||
|
||||
/* Like free_and_replace(), but for file descriptors */
|
||||
#define CLOSE_AND_REPLACE(a, b) \
|
||||
#define close_and_replace(a, b) \
|
||||
({ \
|
||||
int *_fdp_ = &(a); \
|
||||
safe_close(*_fdp_); \
|
||||
|
@ -4073,7 +4073,7 @@ static int add_shifted_fd(int *fds, size_t fds_size, size_t *n_fds, int fd, int
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
CLOSE_AND_REPLACE(fd, r);
|
||||
close_and_replace(fd, r);
|
||||
}
|
||||
|
||||
*ret_fd = fds[*n_fds] = fd;
|
||||
|
@ -2041,8 +2041,7 @@ void home_process_notify(Home *h, char **l, int fd) {
|
||||
if (taken_fd < 0)
|
||||
return (void) log_debug("Got notify message with SYSTEMD_LUKS_LOCK_FD=1 but no fd passed, ignoring: %m");
|
||||
|
||||
safe_close(h->luks_lock_fd);
|
||||
h->luks_lock_fd = TAKE_FD(taken_fd);
|
||||
close_and_replace(h->luks_lock_fd, taken_fd);
|
||||
|
||||
log_debug("Successfully acquired LUKS lock fd from worker.");
|
||||
|
||||
|
@ -195,7 +195,7 @@ static int raw_import_maybe_convert_qcow2(RawImport *i) {
|
||||
|
||||
unlink_and_free(i->temp_path);
|
||||
i->temp_path = TAKE_PTR(t);
|
||||
CLOSE_AND_REPLACE(i->output_fd, converted_fd);
|
||||
close_and_replace(i->output_fd, converted_fd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ static int raw_pull_maybe_convert_qcow2(RawPull *i) {
|
||||
|
||||
unlink_and_free(i->temp_path);
|
||||
i->temp_path = TAKE_PTR(t);
|
||||
CLOSE_AND_REPLACE(i->raw_job->disk_fd, converted_fd);
|
||||
close_and_replace(i->raw_job->disk_fd, converted_fd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ int sd_ipv4acd_start(sd_ipv4acd *acd, bool reset_conflicts) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
CLOSE_AND_REPLACE(acd->fd, r);
|
||||
close_and_replace(acd->fd, r);
|
||||
|
||||
if (reset_conflicts)
|
||||
acd->n_conflict = 0;
|
||||
|
@ -188,7 +188,7 @@ static int session_device_start(SessionDevice *sd) {
|
||||
|
||||
/* For evdev devices, the file descriptor might be left uninitialized. This might happen while resuming
|
||||
* into a session and logind has been restarted right before. */
|
||||
CLOSE_AND_REPLACE(sd->fd, r);
|
||||
close_and_replace(sd->fd, r);
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_UNKNOWN:
|
||||
|
@ -298,7 +298,7 @@ int copy_data_fd(int fd) {
|
||||
if (f != 0)
|
||||
return -errno;
|
||||
|
||||
CLOSE_AND_REPLACE(copy_fd, tmp_fd);
|
||||
close_and_replace(copy_fd, tmp_fd);
|
||||
|
||||
remains = mfree(remains);
|
||||
remains_size = 0;
|
||||
|
@ -2184,7 +2184,7 @@ static int mkdir_parents_rm_if_wrong_type(mode_t child_mode, const char *path) {
|
||||
return log_error_errno(r, "Failed to stat \"%s\" at \"%s\": %m", t, strnull(parent_name));
|
||||
}
|
||||
|
||||
CLOSE_AND_REPLACE(parent_fd, next_fd);
|
||||
close_and_replace(parent_fd, next_fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user