summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2016-09-28 20:50:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-10-04 21:14:19 +0200
commit90184dbc3691fd0ba188682fdc55d82a2af230ed (patch)
tree4440fc9355a0efd3a0a9af5a7f5e082e07dd44c9 /scripts
parentebec4450929ad823e06bea14192c07d3cc69210a (diff)
downloadbarebox-90184dbc3691fd0ba188682fdc55d82a2af230ed.tar.gz
barebox-90184dbc3691fd0ba188682fdc55d82a2af230ed.tar.xz
scripts: kwboot: simplify kwboot_mmap_image
There was only a single caller who passes prot=PROT_READ unconditionally. So drop this parameter and simplify accordingly. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kwboot.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 58ea1ad7a7..1fcb49b7ac 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -657,9 +657,9 @@ kwboot_check_image(const unsigned char *img, size_t size)
}
static void *
-kwboot_mmap_image(const char *path, size_t *size, int prot)
+kwboot_mmap_image(const char *path, size_t *size)
{
- int rc, fd, flags;
+ int rc, fd;
struct stat st;
void *img;
@@ -674,9 +674,7 @@ kwboot_mmap_image(const char *path, size_t *size, int prot)
if (rc)
goto out;
- flags = (prot & PROT_WRITE) ? MAP_PRIVATE : MAP_SHARED;
-
- img = mmap(NULL, st.st_size, prot, flags, fd, 0);
+ img = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (img == MAP_FAILED) {
img = NULL;
goto out;
@@ -793,7 +791,7 @@ main(int argc, char **argv)
}
if (imgpath) {
- img = kwboot_mmap_image(imgpath, &size, PROT_READ);
+ img = kwboot_mmap_image(imgpath, &size);
if (!img) {
perror(imgpath);
goto out;