tree-wide: drop if braces around single line expressions as well

This commit is contained in:
Frantisek Sumsal 2020-10-09 15:06:34 +02:00
parent d7a0f1f4f9
commit d46b79bbe0
13 changed files with 14 additions and 31 deletions

View File

@ -1393,13 +1393,12 @@ static int copy_quota_hierarchy(int fd, uint64_t old_subvol_id, uint64_t new_sub
}
for (j = 0; j < n_old_parent_qgroups; j++)
if (old_parent_qgroups[j] == old_qgroups[i]) {
if (old_parent_qgroups[j] == old_qgroups[i])
/* The old subvolume shared a common
* parent qgroup with its parent
* subvolume. Let's set up something
* similar in the destination. */
copy_from_parent = true;
}
}
if (!insert_intermediary_qgroup && !copy_from_parent)

View File

@ -540,10 +540,8 @@ static void automount_trigger_notify(Unit *u, Unit *other) {
MOUNT_MOUNTED, MOUNT_REMOUNTING,
MOUNT_REMOUNTING_SIGTERM, MOUNT_REMOUNTING_SIGKILL,
MOUNT_UNMOUNTING_SIGTERM, MOUNT_UNMOUNTING_SIGKILL,
MOUNT_FAILED)) {
MOUNT_FAILED))
(void) automount_send_ready(a, a->expire_tokens, -ENODEV);
}
if (MOUNT(other)->state == MOUNT_DEAD)
(void) automount_send_ready(a, a->expire_tokens, 0);

View File

@ -5772,11 +5772,10 @@ void exec_status_start(ExecStatus *s, pid_t pid) {
void exec_status_exit(ExecStatus *s, const ExecContext *context, pid_t pid, int code, int status) {
assert(s);
if (s->pid != pid) {
if (s->pid != pid)
*s = (ExecStatus) {
.pid = pid,
};
}
dual_timestamp_get(&s->exit_timestamp);

View File

@ -1562,7 +1562,7 @@ static void initialize_clock(void) {
else
log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
} else if (!in_initrd()) {
} else if (!in_initrd())
/*
* Do a dummy very first call to seal the kernel's time warp magic.
*
@ -1575,7 +1575,6 @@ static void initialize_clock(void) {
* be treated as UTC that way.
*/
(void) clock_reset_timewarp();
}
r = clock_apply_epoch();
if (r < 0)

View File

@ -1618,13 +1618,12 @@ int setup_namespace(
if (r < 0)
goto finish;
if (ns_info->private_dev) {
if (ns_info->private_dev)
*(m++) = (MountEntry) {
.path_const = "/dev",
.mode = PRIVATE_DEV,
.flags = DEV_MOUNT_OPTIONS,
};
}
if (ns_info->protect_kernel_tunables) {
r = append_static_mounts(&m,
@ -1653,12 +1652,11 @@ int setup_namespace(
goto finish;
}
if (ns_info->protect_control_groups) {
if (ns_info->protect_control_groups)
*(m++) = (MountEntry) {
.path_const = "/sys/fs/cgroup",
.mode = READONLY,
};
}
r = append_protect_home(&m, ns_info->protect_home, ns_info->ignore_protect_paths);
if (r < 0)

View File

@ -26,11 +26,10 @@ int dhcp_validate_duid_len(uint16_t duid_type, size_t duid_len, bool strict) {
if (duid_len > MAX_DUID_LEN)
return -EINVAL;
if (!strict) {
if (!strict)
/* Strict validation is not requested. We only ensure that the
* DUID is not too long. */
return 0;
}
switch (duid_type) {
case DUID_TYPE_LLT:

View File

@ -1880,12 +1880,11 @@ static int client_receive_message_udp(
assert(client);
buflen = next_datagram_size_fd(fd);
if (buflen == -ENETDOWN) {
if (buflen == -ENETDOWN)
/* the link is down. Don't return an error or the I/O event
source will be disconnected and we won't be able to receive
packets again when the link comes back. */
return 0;
}
if (buflen < 0)
return buflen;

View File

@ -1233,9 +1233,8 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
if (!a)
return -ENOMEM;
if (!strv_isempty(a)) {
if (!strv_isempty(a))
lease->search_domains = TAKE_PTR(a);
}
}
if (routes) {

View File

@ -1420,12 +1420,11 @@ static int client_receive_message(
assert(client->event);
buflen = next_datagram_size_fd(fd);
if (buflen == -ENETDOWN) {
if (buflen == -ENETDOWN)
/* the link is down. Don't return an error or the I/O event
source will be disconnected and we won't be able to receive
packets again when the link comes back. */
return 0;
}
if (buflen < 0)
return buflen;

View File

@ -1653,12 +1653,11 @@ static int link_status_one(
if (r < 0)
return table_log_add_error(r);
if (info->port_state <= BR_STATE_BLOCKING) {
if (info->port_state <= BR_STATE_BLOCKING)
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "Port State:",
TABLE_STRING, bridge_state_to_string(info->port_state));
}
} else if (streq_ptr(info->netdev_kind, "bond")) {
r = table_add_many(table,
TABLE_EMPTY,

View File

@ -908,13 +908,11 @@ static int dns_query_cname_redirect(DnsQuery *q, const DnsResourceRecord *cname)
if (r == 0 && k == 0) /* No actual cname happened? */
return -ELOOP;
if (q->answer_protocol == DNS_PROTOCOL_DNS) {
if (q->answer_protocol == DNS_PROTOCOL_DNS)
/* Don't permit CNAME redirects from unicast DNS to LLMNR or MulticastDNS, so that global resources
* cannot invade the local namespace. The opposite way we permit: local names may redirect to global
* ones. */
q->flags &= ~(SD_RESOLVED_LLMNR|SD_RESOLVED_MDNS); /* mask away the local protocols */
}
/* Turn off searching for the new name */
q->flags |= SD_RESOLVED_NO_SEARCH;

View File

@ -538,14 +538,13 @@ static int parse_argv(int argc, char *argv[]) {
arg_aggressive_gc = true;
}
if (arg_stdio == ARG_STDIO_AUTO) {
if (arg_stdio == ARG_STDIO_AUTO)
/* If we both --pty and --pipe are specified we'll automatically pick --pty if we are connected fully
* to a TTY and pick direct fd passing otherwise. This way, we automatically adapt to usage in a shell
* pipeline, but we are neatly interactive with tty-level isolation otherwise. */
arg_stdio = isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) && isatty(STDERR_FILENO) ?
ARG_STDIO_PTY :
ARG_STDIO_DIRECT;
}
if (argc > optind) {
char **l;

View File

@ -473,15 +473,13 @@ int pty_forward_new(
f->master = master;
if (ioctl(f->output_fd, TIOCGWINSZ, &ws) < 0) {
if (ioctl(f->output_fd, TIOCGWINSZ, &ws) < 0)
/* If we can't get the resolution from the output fd, then use our internal, regular width/height,
* i.e. something derived from $COLUMNS and $LINES if set. */
ws = (struct winsize) {
.ws_row = lines(),
.ws_col = columns(),
};
}
(void) ioctl(master, TIOCSWINSZ, &ws);