summaryrefslogtreecommitdiff
path: root/yaffs_nameval.c
diff options
context:
space:
mode:
authorCharles Manning <cdhmanning@gmail.com>2011-02-04 09:06:11 +1300
committerCharles Manning <cdhmanning@gmail.com>2011-02-04 09:06:11 +1300
commit30531f82cc7712126b10f3b05e3b50e7577d0778 (patch)
treefae46497cfad670f8527364d62f084a54ddd22ba /yaffs_nameval.c
parent7dea5fe7a9a58636b5ce32fdbd58541c95c4a37d (diff)
yaffs: Change return value when xattrib delete not found
This does not modify the functioning of yaffs, just makes a better internal error message. Signed-off-by: Charles Manning <cdhmanning@gmail.com>
Diffstat (limited to 'yaffs_nameval.c')
-rw-r--r--yaffs_nameval.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/yaffs_nameval.c b/yaffs_nameval.c
index e521622..e75411b 100644
--- a/yaffs_nameval.c
+++ b/yaffs_nameval.c
@@ -50,7 +50,7 @@ static int nval_find(const char *xb, int xb_size, const YCHAR *name,
}
if (exist_size)
*exist_size = 0;
- return -1;
+ return -ENODATA;
}
static int nval_used(const char *xb, int xb_size)
@@ -74,16 +74,15 @@ int nval_del(char *xb, int xb_size, const YCHAR *name)
int pos = nval_find(xb, xb_size, name, NULL);
int size;
- if (pos >= 0 && pos < xb_size) {
- /* Find size, shift rest over this record,
- * then zero out the rest of buffer */
- memcpy(&size, xb + pos, sizeof(int));
- memcpy(xb + pos, xb + pos + size, xb_size - (pos + size));
- memset(xb + (xb_size - size), 0, size);
- return 0;
- } else {
+ if (pos < 0 || pos >= xb_size)
return -ENODATA;
- }
+
+ /* Find size, shift rest over this record,
+ * then zero out the rest of buffer */
+ memcpy(&size, xb + pos, sizeof(int));
+ memcpy(xb + pos, xb + pos + size, xb_size - (pos + size));
+ memset(xb + (xb_size - size), 0, size);
+ return 0;
}
int nval_set(char *xb, int xb_size, const YCHAR *name, const char *buf,