summaryrefslogtreecommitdiffstats
path: root/disk-utils/isosize.c
diff options
context:
space:
mode:
authorSami Kerola2014-02-17 00:54:20 +0100
committerKarel Zak2014-02-17 14:04:41 +0100
commit799e58424559a944dd998bc49e206a9805395ee4 (patch)
tree25e27b6d3cdcf95501f8aa52c0b7f1713b375d46 /disk-utils/isosize.c
parentswaplabel: wrong version number in check (diff)
downloadkernel-qcow2-util-linux-799e58424559a944dd998bc49e206a9805395ee4.tar.gz
kernel-qcow2-util-linux-799e58424559a944dd998bc49e206a9805395ee4.tar.xz
kernel-qcow2-util-linux-799e58424559a944dd998bc49e206a9805395ee4.zip
isosize: move file name printing after error determination
Earlier the filename printing was buffered, and exit at error made output to appear in front of prompt. Output below demonstrates the brokenness. prompt> isosize /etc / isosize: /etc: might not be an ISO filesystem isosize: read error on /etc: Is a directory /etc: prompt> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'disk-utils/isosize.c')
-rw-r--r--disk-utils/isosize.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c
index 4c16ec52d..f90029e2a 100644
--- a/disk-utils/isosize.c
+++ b/disk-utils/isosize.c
@@ -125,7 +125,7 @@ struct iso_primary_descriptor
unsigned char unused5 [ISODCL (1396, 2048)];
};
-static void isosize(char *filenamep, int xflag, long divisor)
+static void isosize(int argc, char *filenamep, int xflag, long divisor)
{
int fd, nsecs, ssize;
struct iso_primary_descriptor ipd;
@@ -145,6 +145,8 @@ static void isosize(char *filenamep, int xflag, long divisor)
/* isonum_723 returns nowadays always 2048 */
ssize = isonum_723(ipd.logical_block_size, xflag);
+ if (1 < argc)
+ printf("%s: ", filenamep);
if (xflag) {
printf(_("sector count: %d, sector size: %d\n"), nsecs, ssize);
} else {
@@ -220,11 +222,8 @@ int main(int argc, char **argv)
if (ct <= 0)
usage(stderr);
- for (j = optind; j < argc; j++) {
- if (ct > 1)
- printf("%s: ", argv[j]);
- isosize(argv[j], xflag, divisor);
- }
+ for (j = optind; j < argc; j++)
+ isosize(ct, argv[j], xflag, divisor);
return EXIT_SUCCESS;
}