From: Eric Sandeen <sandeen@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 2/5] e2image: eliminate division by zero
Date: Fri, 03 Jan 2014 10:40:25 -0600 [thread overview]
Message-ID: <52C6E7F9.8030809@redhat.com> (raw)
In-Reply-To: <1388726998-14349-2-git-send-email-tytso@mit.edu>
On 1/2/14, 11:29 PM, Theodore Ts'o wrote:
> Dividing a floating point number by zero is undefined in C. It
> happens to work with gcc/glibc, but it's not something that's
> guaranteed.
>
> Addresses-Coverity-ID: #1147781
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> misc/e2image.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/misc/e2image.c b/misc/e2image.c
> index 253fad1..ac62ffe 100644
> --- a/misc/e2image.c
> +++ b/misc/e2image.c
> @@ -704,14 +704,15 @@ more_blocks:
> if (show_progress) {
> time_t duration = time(NULL) - start_time;
> char buff[30];
> - while (bscount--)
> - fputc('\b', stderr);
> + fputc('\r', stderr);
> strftime(buff, 30, "%T", gmtime(&duration));
> - fprintf(stderr, _("\b\b\b\b\b\b\b\bCopied %llu / %llu "
> - "blocks (%d%%) in %s at %.2f MB/s \n"),
> - total_written, meta_blocks_count,
> - calc_percent(total_written, meta_blocks_count), buff,
> - calc_rate(total_written, fs->blocksize, duration));
> + fprintf(stderr, _("Copied %llu / %llu blocks (%d%%) in %s "),
> + total_written, meta_blocks_count,
> + calc_percent(total_written, meta_blocks_count), buff);
> + if (duration)
> + fprintf(stderr, _("at %.2f MB/s"),
> + calc_rate(total_written, fs->blocksize, duration));
> + fputs(" \n", stderr);
> }
> #ifdef HAVE_FTRUNCATE64
> if (sparse) {
>
next prev parent reply other threads:[~2014-01-03 16:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-03 5:29 [PATCH 1/5] e2image: fix resource leak when running e2image -n Theodore Ts'o
2014-01-03 5:29 ` [PATCH 2/5] e2image: eliminate division by zero Theodore Ts'o
2014-01-03 16:40 ` Eric Sandeen [this message]
2014-01-03 5:29 ` [PATCH 3/5] e2image: avoid potential divide " Theodore Ts'o
2014-01-03 16:42 ` Eric Sandeen
2014-01-03 5:29 ` [PATCH 4/5] libblkid: fix sizeof(foo) vs sizeof(*foo) malloc() bug Theodore Ts'o
2014-01-03 16:44 ` Eric Sandeen
2014-01-03 5:29 ` [PATCH 5/5] subst: clean up various coverity nits Theodore Ts'o
2014-01-03 16:32 ` [PATCH 1/5] e2image: fix resource leak when running e2image -n Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52C6E7F9.8030809@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).