diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-07-08 06:06:07 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2015-07-08 06:06:07 +0000 |
commit | 47864f2c6d1104ae7dc645ffeeca40568eec3307 (patch) | |
tree | a1eb3bab0083bdd847d0a1d2189061600a5caad2 /package/utils | |
parent | b84a8b054325d66e75fca15ff4f88417e690fa13 (diff) | |
download | upstream-47864f2c6d1104ae7dc645ffeeca40568eec3307.tar.gz upstream-47864f2c6d1104ae7dc645ffeeca40568eec3307.tar.bz2 upstream-47864f2c6d1104ae7dc645ffeeca40568eec3307.zip |
nvram: get rid of NVRAM_SPACE
Now we support NVRAM whatever its size is.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Backport of r46262
git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@46263 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/utils')
-rw-r--r-- | package/utils/nvram/src/nvram.c | 4 | ||||
-rw-r--r-- | package/utils/nvram/src/nvram.h | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/package/utils/nvram/src/nvram.c b/package/utils/nvram/src/nvram.c index c490597d4b..0e4294391a 100644 --- a/package/utils/nvram/src/nvram.c +++ b/package/utils/nvram/src/nvram.c @@ -65,7 +65,7 @@ static void _nvram_free(nvram_handle_t *h) static nvram_tuple_t * _nvram_realloc( nvram_handle_t *h, nvram_tuple_t *t, const char *name, const char *value ) { - if ((strlen(value) + 1) > NVRAM_SPACE) + if ((strlen(value) + 1) > h->length - h->offset) return NULL; if (!t) { @@ -395,7 +395,7 @@ nvram_handle_t * nvram_open(const char *file, int rdonly) header = nvram_header(h); if (header->magic == NVRAM_MAGIC && - (rdonly || header->len < NVRAM_SPACE)) { + (rdonly || header->len < h->length - h->offset)) { _nvram_rehash(h); free(mtd); return h; diff --git a/package/utils/nvram/src/nvram.h b/package/utils/nvram/src/nvram.h index 215d816327..724f33b811 100644 --- a/package/utils/nvram/src/nvram.h +++ b/package/utils/nvram/src/nvram.h @@ -114,7 +114,6 @@ char * nvram_find_staging(void); /* NVRAM constants */ #define NVRAM_MIN_SPACE 0x8000 -#define NVRAM_SPACE 0x10000 #define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ #define NVRAM_VERSION 1 |