linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, goliath@sigma-star.at,
	Richard Weinberger <richard@nod.at>
Subject: [PATCH 2/5] ubinize: Don't stat image file twice
Date: Mon, 14 May 2018 13:25:25 +0200	[thread overview]
Message-ID: <20180514112528.24092-3-richard@nod.at> (raw)
In-Reply-To: <20180514112528.24092-1-richard@nod.at>

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 ubi-utils/ubinize.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c
index c85ff9b22c58..3390d0d95305 100644
--- a/ubi-utils/ubinize.c
+++ b/ubi-utils/ubinize.c
@@ -335,16 +335,11 @@ static int read_section(const struct ubigen_info *ui, const char *sname,
 				      sname, *img, (long long)st->st_size, vi->bytes);
 		verbose(args.verbose, "volume size: %lld bytes", vi->bytes);
 	} else {
-		struct stat st;
-
 		if (!*img)
 			return errmsg("neither image file (\"image=\") nor volume size "
 				      "(\"vol_size=\") specified in section \"%s\"", sname);
 
-		if (stat(*img, &st))
-			return sys_errmsg("cannot stat \"%s\"", *img);
-
-		vi->bytes = st.st_size;
+		vi->bytes = st->st_size;
 
 		if (vi->bytes == 0)
 			return errmsg("file \"%s\" referred from section \"%s\" is empty",
-- 
2.13.6

  parent reply	other threads:[~2018-05-14 11:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 11:25 [PATCH 0/5] mtd-utils: Add fastmap support to ubinize Richard Weinberger
2018-05-14 11:25 ` [PATCH 1/5] Sync ubi-media.h with Linux Richard Weinberger
2018-05-14 11:25 ` Richard Weinberger [this message]
2018-05-14 11:25 ` [PATCH 3/5] libubigen: Carry image path and size in volume info Richard Weinberger
2018-05-14 11:25 ` [PATCH 4/5] libubigen: Maintain a eraseblock association table Richard Weinberger
2018-05-15 19:58   ` David Oberhollenzer
2018-05-15 20:22     ` Richard Weinberger
2018-05-14 11:25 ` [PATCH 5/5] ubinize: Add fastmap support Richard Weinberger

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=20180514112528.24092-3-richard@nod.at \
    --to=richard@nod.at \
    --cc=goliath@sigma-star.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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).