lkml.org 
[lkml]   [2018]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/5] ubinize: Don't stat image file twice
Date
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
\
 
 \ /
  Last update: 2018-05-14 13:27    [W:0.058 / U:0.992 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site