summaryrefslogtreecommitdiffstats
path: root/common/state/backend_bucket_direct.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-23 11:29:50 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 18:43:53 +0200
commit5207445cfd1f5fcb592cf4337691ec4b85170c65 (patch)
treee03c108d0bc81a317c2557c4449a43dfa0d97bb7 /common/state/backend_bucket_direct.c
parent238008b4bd8f263762c654c42e6176e3629977c1 (diff)
downloadbarebox-5207445cfd1f5fcb592cf4337691ec4b85170c65.tar.gz
barebox-5207445cfd1f5fcb592cf4337691ec4b85170c65.tar.xz
state: backend-direct: Fix max_size
The max_size in the direct backend includes the meta data, so substract its size when determing the max data size we can store. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state/backend_bucket_direct.c')
-rw-r--r--common/state/backend_bucket_direct.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index 246cb499c4..9996ac2919 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -103,7 +103,7 @@ static int state_backend_bucket_direct_write(struct state_backend_storage_bucket
int ret;
struct state_backend_storage_bucket_direct_meta meta;
- if (direct->max_size && len > direct->max_size)
+ if (direct->max_size && len > direct->max_size - sizeof(meta))
return -E2BIG;
ret = lseek(direct->fd, direct->offset, SEEK_SET);