aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeebs <seebs@seebs.net>2018-09-20 15:49:26 -0500
committerSeebs <seebs@seebs.net>2018-09-20 15:49:26 -0500
commit6294b344e5140f5467e6860f45a174440015304e (patch)
treee13f67f7d678da0f02e079e3a3ddca0b94392f3b
parent82b22f9d8cea2f8b29428b500bd1cefd412afbe2 (diff)
downloadpseudo-6294b344e5140f5467e6860f45a174440015304e.tar.gz
pseudo-6294b344e5140f5467e6860f45a174440015304e.tar.bz2
pseudo-6294b344e5140f5467e6860f45a174440015304e.zip
also make sure inodes are 64-bit values to SQL
bind_int doesn't handle 64-bit ints on most targets, we need bind_int64, and weren't using it. What a silly bug. Caught and fixed by <Jack.Fewx@dell.com>. Signed-off-by: seebs <seebs@seebs.net>
-rw-r--r--ChangeLog.txt3
-rw-r--r--pseudo_db.c18
2 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 6bbace5..e0c66fc 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -2,6 +2,9 @@
* (seebs) coerce inodes to signed int64_t range when shoving
them into sqlite.
* (seebs) add another /*fallthrough*/ comment to make gcc7 happy.
+ * (seebs) also make sure inodes are handled as 64-bit, not
+ 32-bit, which probably matters more. Thanks to <Jack.Fewx@dell.com>
+ for catching this.
2018-04-13:
* (seebs) Reduce spamminess of path mismatches.
diff --git a/pseudo_db.c b/pseudo_db.c
index d5dca39..0994048 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -1536,9 +1536,9 @@ pdb_clear_xattrs(pseudo_msg_t *msg) {
}
}
sqlite3_bind_int(delete, 1, msg->dev);
- sqlite3_bind_int(delete, 2, signed_ino(msg->ino));
+ sqlite3_bind_int64(delete, 2, signed_ino(msg->ino));
sqlite3_bind_int(delete, 3, msg->dev);
- sqlite3_bind_int(delete, 4, signed_ino(msg->ino));
+ sqlite3_bind_int64(delete, 4, signed_ino(msg->ino));
rc = sqlite3_step(delete);
if (rc != SQLITE_DONE) {
dberr(file_db, "delete of unused xattrs may have failed");
@@ -1573,9 +1573,9 @@ pdb_copy_xattrs(pseudo_msg_t *oldmsg, pseudo_msg_t *msg) {
}
}
sqlite3_bind_int(copy, 1, msg->dev);
- sqlite3_bind_int(copy, 2, signed_ino(msg->ino));
+ sqlite3_bind_int64(copy, 2, signed_ino(msg->ino));
sqlite3_bind_int(copy, 3, oldmsg->dev);
- sqlite3_bind_int(copy, 4, signed_ino(oldmsg->ino));
+ sqlite3_bind_int64(copy, 4, signed_ino(oldmsg->ino));
rc = sqlite3_step(copy);
if (rc != SQLITE_DONE) {
dberr(file_db, "copy of xattrs may have failed");
@@ -1605,7 +1605,7 @@ pdb_check_xattrs(pseudo_msg_t *msg) {
}
int existing;
sqlite3_bind_int(scan, 1, msg->dev);
- sqlite3_bind_int(scan, 2, signed_ino(msg->ino));
+ sqlite3_bind_int64(scan, 2, signed_ino(msg->ino));
rc = sqlite3_step(scan);
if (rc == SQLITE_ROW) {
existing = (int) sqlite3_column_int64(scan, 0);
@@ -2495,7 +2495,7 @@ pdb_get_xattr(pseudo_msg_t *msg, char **value, size_t *len) {
}
pseudo_debug(PDBGF_XATTR, "requested xattr named '%s' for ino %lld\n", *value, (long long) msg->ino);
sqlite3_bind_int(select, 1, msg->dev);
- sqlite3_bind_int(select, 2, signed_ino(msg->ino));
+ sqlite3_bind_int64(select, 2, signed_ino(msg->ino));
rc = sqlite3_bind_text(select, 3, *value, -1, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr name to SELECT.");
@@ -2557,7 +2557,7 @@ pdb_list_xattr(pseudo_msg_t *msg, char **value, size_t *len) {
}
}
sqlite3_bind_int(select, 1, msg->dev);
- sqlite3_bind_int(select, 2, signed_ino(msg->ino));
+ sqlite3_bind_int64(select, 2, signed_ino(msg->ino));
do {
rc = sqlite3_step(select);
if (rc == SQLITE_ROW) {
@@ -2611,7 +2611,7 @@ pdb_remove_xattr(pseudo_msg_t *msg, char *value, size_t len) {
}
}
sqlite3_bind_int(delete, 1, msg->dev);
- sqlite3_bind_int(delete, 2, signed_ino(msg->ino));
+ sqlite3_bind_int64(delete, 2, signed_ino(msg->ino));
rc = sqlite3_bind_text(delete, 3, value, len, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr name to DELETE.");
@@ -2652,7 +2652,7 @@ pdb_set_xattr(pseudo_msg_t *msg, char *value, size_t len, int flags) {
}
}
sqlite3_bind_int(select, 1, msg->dev);
- sqlite3_bind_int(select, 2, signed_ino(msg->ino));
+ sqlite3_bind_int64(select, 2, signed_ino(msg->ino));
rc = sqlite3_bind_text(select, 3, value, -1, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr name to SELECT.");