aboutsummaryrefslogtreecommitdiffstats
path: root/disk-utils/sfdisk.c
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-04-18 22:16:22 -0700
committerRosen Penev <rosenp@gmail.com>2020-04-20 13:20:59 -0700
commit042f62dfc514da177c148c257e4dcb32e5f8379d (patch)
tree01c1fcf37bc8d5439a82cca46fa7cb39f88126f3 /disk-utils/sfdisk.c
parentbd89499e07a85b399a345e319e61d0afc5f3088c (diff)
downloadutil-linux-042f62dfc514da177c148c257e4dcb32e5f8379d.tar.gz
[clang-tidy] do not use else after return
Found with readability-else-after-return Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'disk-utils/sfdisk.c')
-rw-r--r--disk-utils/sfdisk.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 0c14627799..24d1f729c4 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -1869,14 +1869,18 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
buf[sizeof(buf) - 1] = '\0';
fdisk_warnx(sf->cxt, _("Unknown script header '%s' -- ignore."), buf);
continue;
- } else if (rc < 0) {
+ }
+
+ if (rc < 0) {
DBG(PARSE, ul_debug("script parsing failed, trying sfdisk specific commands"));
buf[sizeof(buf) - 1] = '\0';
rc = loop_control_commands(sf, dp, buf);
if (rc)
break;
continue;
- } else if (rc == 1) {
+ }
+
+ if (rc == 1) {
rc = SFDISK_DONE_EOF;
if (!sf->quiet)
fputs(_("Done.\n"), stdout);
@@ -1910,7 +1914,9 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
rc = fdisk_set_partition(sf->cxt, partno, pa);
rc = rc == 0 ? SFDISK_DONE_ASK : SFDISK_DONE_ABORT;
break;
- } else if (!rc) { /* add partition */
+ }
+
+ if (!rc) { /* add partition */
if (!sf->interactive && !sf->quiet &&
(!sf->prompt || startswith(sf->prompt, SFDISK_PROMPT))) {
refresh_prompt_buffer(sf, devname, next_partno, created);