aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-04-24 12:23:20 -0500
committerPeter Seebach <peter.seebach@windriver.com>2014-04-24 17:05:52 -0500
commit9c0a65c563c11b5b1bdf71787598ee25314b0d3a (patch)
treefeb559747a6d04ad1e3c8ec59b5343d9a8922d11
parent5392d265efd29e374080dca062ff1d1a834bfbed (diff)
downloadpseudo-9c0a65c563c11b5b1bdf71787598ee25314b0d3a.tar.gz
pseudo-9c0a65c563c11b5b1bdf71787598ee25314b0d3a.tar.bz2
pseudo-9c0a65c563c11b5b1bdf71787598ee25314b0d3a.zip
Use correct length when creating new xattr
Was using the length of the name instead of the length of the value on insert, but not on update, so initial settings of values were busted often. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
-rw-r--r--pseudo_db.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pseudo_db.c b/pseudo_db.c
index c7b6585..e361ab2 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -2377,8 +2377,8 @@ pdb_set_xattr(long long file_id, char *value, size_t len, int flags) {
vlen = strlen(value);
len = len - (vlen + 1);
value = value + vlen + 1;
- pseudo_debug(PDBGF_XATTR, "trying to set a value for %lld: name is '%s' [%d/%d bytes], value is '%s'. Existing row %lld.\n",
- file_id, vname, (int) vlen, (int) (len + vlen + 1), value, existing_row);
+ pseudo_debug(PDBGF_XATTR, "trying to set a value for %lld: name is '%s' [%d/%d bytes], value is '%s' [%d bytes]. Existing row %lld.\n",
+ file_id, vname, (int) vlen, (int) (len + vlen + 1), value, (int) len, existing_row);
if (existing_row != -1) {
/* update */
if (!update) {
@@ -2418,7 +2418,7 @@ pdb_set_xattr(long long file_id, char *value, size_t len, int flags) {
dberr(file_db, "couldn't bind xattr name to INSERT statement");
return 1;
}
- rc = sqlite3_bind_text(insert, 3, value, vlen, SQLITE_STATIC);
+ rc = sqlite3_bind_text(insert, 3, value, len, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr value to INSERT statement");
return 1;