Browse Source

inode 0 is invalid: don't try to match it from a DB

Otherwise, a new file with an invalid inode is considered like a rename
of another file with an invalid inode
Olivier Goffart 12 years ago
parent
commit
60636cdbd5
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/csync_statedb.c

+ 4 - 0
src/csync_statedb.c

@@ -482,6 +482,10 @@ csync_file_stat_t *csync_statedb_get_stat_by_inode(sqlite3 *db,
   char *stmt = NULL;
   size_t len = 0;
 
+  if (!inode) {
+      return NULL;
+  }
+
   stmt = sqlite3_mprintf("SELECT * FROM metadata WHERE inode='%lld'",
              (long long signed int) inode);
   if (stmt == NULL) {