From d46b79bbe0e821b921a8f3874c5ea4b50bde9252 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 9 Oct 2020 15:06:34 +0200 Subject: [PATCH] tree-wide: drop if braces around single line expressions as well --- src/basic/btrfs-util.c | 3 +-- src/core/automount.c | 4 +--- src/core/execute.c | 3 +-- src/core/main.c | 3 +-- src/core/namespace.c | 6 ++---- src/libsystemd-network/dhcp-identifier.c | 3 +-- src/libsystemd-network/sd-dhcp-client.c | 3 +-- src/libsystemd-network/sd-dhcp-lease.c | 3 +-- src/libsystemd-network/sd-dhcp6-client.c | 3 +-- src/network/networkctl.c | 3 +-- src/resolve/resolved-dns-query.c | 4 +--- src/run/run.c | 3 +-- src/shared/ptyfwd.c | 4 +--- 13 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c index 43a58918e9d..50a35268ea1 100644 --- a/src/basic/btrfs-util.c +++ b/src/basic/btrfs-util.c @@ -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) diff --git a/src/core/automount.c b/src/core/automount.c index b0d43a3ef40..9c0dca1b3a7 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -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); diff --git a/src/core/execute.c b/src/core/execute.c index 5264b8f0919..d21de8c41e0 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -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); diff --git a/src/core/main.c b/src/core/main.c index 08504961a27..6cd596fa79b 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -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) diff --git a/src/core/namespace.c b/src/core/namespace.c index 92df97c4fb2..05bd4da1544 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -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) diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c index d0610a32e23..e7dbec1511c 100644 --- a/src/libsystemd-network/dhcp-identifier.c +++ b/src/libsystemd-network/dhcp-identifier.c @@ -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: diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 265b6eab443..1b622ce5a8f 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -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; diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 0aa6a63c0a9..5f89d00452e 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -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) { diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 38025b63d92..e1dbdaff4e7 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -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; diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 0c4f93045f4..86e53e6da42 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -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, diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c index 3afe4cf73bc..1eff893b21d 100644 --- a/src/resolve/resolved-dns-query.c +++ b/src/resolve/resolved-dns-query.c @@ -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; diff --git a/src/run/run.c b/src/run/run.c index 9ea3de4b176..41796243131 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -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; diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index 305fd8a0f18..6bcdfff41a7 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -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); -- 2.39.2