Fix null termination.

This commit is contained in:
Andreas Schneider 2008-05-07 11:29:48 +02:00
parent e41e8e1610
commit b1f8ab38c9

View file

@ -46,7 +46,7 @@ static int csync_journal_check(const char *journal) {
fd = open(journal, O_RDONLY); fd = open(journal, O_RDONLY);
if (fd >= 0) { if (fd >= 0) {
if (read(fd, (void *) buf, (size_t) BUF_SIZE - 1) >= 0) { if (read(fd, (void *) buf, (size_t) BUF_SIZE - 1) >= 0) {
buf[BUF_SIZE] = '\0'; buf[BUF_SIZE - 1] = '\0';
close(fd); close(fd);
if (c_streq(buf, "SQLite format 3")) { if (c_streq(buf, "SQLite format 3")) {
if (sqlite3_open(journal, &db ) == SQLITE_OK) { if (sqlite3_open(journal, &db ) == SQLITE_OK) {