sfdisk: make --quiet really quiet

References: https://github.com/karelzak/util-linux/issues/268
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2016-02-01 14:30:31 +01:00
parent d09c06baf4
commit c809b20aa4
1 changed files with 5 additions and 3 deletions

View File

@ -1591,13 +1591,15 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
sf->prompt = xstrdup(SFDISK_PROMPT); sf->prompt = xstrdup(SFDISK_PROMPT);
} }
if (sf->prompt && (sf->interactive || !sf->quiet)) {
#ifndef HAVE_LIBREADLINE #ifndef HAVE_LIBREADLINE
if (sf->prompt)
fputs(sf->prompt, stdout); fputs(sf->prompt, stdout);
#else #else
if (!sf->interactive && sf->prompt) if (!sf->interactive)
fputs(sf->prompt, stdout); fputs(sf->prompt, stdout);
#endif #endif
}
rc = fdisk_script_read_line(dp, stdin, buf, sizeof(buf)); rc = fdisk_script_read_line(dp, stdin, buf, sizeof(buf));
if (rc < 0) { if (rc < 0) {
DBG(PARSE, ul_debug("script parsing failed, trying sfdisk specific commands")); DBG(PARSE, ul_debug("script parsing failed, trying sfdisk specific commands"));