Skip to content

Commit

Permalink
Remove terminating \n in syslog() calls
Browse files Browse the repository at this point in the history
Per https://man7.org/linux/man-pages/man3/syslog.3.html: “The
format string need not include a terminating newline character.”

Transformed by:

  sed -i 's/\(syslog.*\) "\\n"\(.*\)/\1\2/' `find -name '*.c*'`
  sed -i 's/\(syslog.*\) \\n\(.*\)/\1\2/' `find -name '*.c*'`
  sed -i 's/\(syslog.*\)\\n\(.*\)/\1\2/' `find -name '*.c*'`

and some manual work.
  • Loading branch information
dilyanpalauzov committed Mar 27, 2021
1 parent 61f0d47 commit 31158d0
Show file tree
Hide file tree
Showing 32 changed files with 120 additions and 120 deletions.
2 changes: 1 addition & 1 deletion backup/backupd.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ static int cmd_apply_message(struct dlist *dl)

message_guid_generate(&computed_guid, msg_base, msg_len);
if (!message_guid_equal(guid, &computed_guid)) {
syslog(LOG_ERR, "%s: guid mismatch: header %s, derived %s\n",
syslog(LOG_ERR, "%s: guid mismatch: header %s, derived %s",
__func__, message_guid_encode(guid),
message_guid_encode(&computed_guid));
r = IMAP_PROTOCOL_ERROR;
Expand Down
4 changes: 2 additions & 2 deletions backup/lcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ EXPORTED int backup_reindex(const char *name,
const char *error = prot_error(member);
if (error && 0 != strcmp(error, PROT_EOF_STRING)) {
syslog(LOG_ERR,
"IOERROR: %s: error reading chunk at offset " OFF_T_FMT ", byte %i: %s\n",
"IOERROR: %s: error reading chunk at offset " OFF_T_FMT ", byte %i: %s",
name, member_offset, prot_bytes_in(member), error);

if (out)
Expand Down Expand Up @@ -647,7 +647,7 @@ EXPORTED int backup_reindex(const char *name,
r = backup_append(backup, dl, &ts, BACKUP_APPEND_NOFLUSH);
if (r) {
// FIXME do something
syslog(LOG_ERR, "backup_append returned %d\n", r);
syslog(LOG_ERR, "backup_append returned %d", r);
fprintf(out, "backup_append returned %d\n", r);
}

Expand Down
6 changes: 3 additions & 3 deletions backup/lcb_append.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ HIDDEN int backup_real_append_start(struct backup *backup,

r = sqldb_exec(backup->db, backup_index_start_sql, bval, NULL, NULL);
if (r) {
syslog(LOG_ERR, "%s: something went wrong: %i\n", __func__, r);
syslog(LOG_ERR, "%s: something went wrong: %i", __func__, r);
sqldb_rollback(backup->db, "backup_append");
goto error;
}
Expand Down Expand Up @@ -257,7 +257,7 @@ HIDDEN int backup_real_append_end(struct backup *backup, time_t ts)
if (!(backup->append_state->mode & BACKUP_APPEND_INDEXONLY)) {
r = gzflush(backup->append_state->gzfile, Z_FINISH);
if (r != Z_OK) {
syslog(LOG_ERR, "IOERROR: gzflush %s failed: %i\n",
syslog(LOG_ERR, "IOERROR: gzflush %s failed: %i",
backup->data_fname, r);
sqldb_rollback(backup->db, "backup_append");
goto done;
Expand All @@ -280,7 +280,7 @@ HIDDEN int backup_real_append_end(struct backup *backup, time_t ts)

r = sqldb_exec(backup->db, backup_index_end_sql, bval, NULL, NULL);
if (r) {
syslog(LOG_ERR, "%s: something went wrong: %i\n", __func__, r);
syslog(LOG_ERR, "%s: something went wrong: %i", __func__, r);
sqldb_rollback(backup->db, "backup_append");
}
else {
Expand Down
2 changes: 1 addition & 1 deletion backup/lcb_compact.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ EXPORTED int backup_compact(const char *name,
const char *error = prot_error(in);
if (error && 0 != strcmp(error, PROT_EOF_STRING)) {
syslog(LOG_ERR,
"IOERROR: %s: error reading chunk at offset " OFF_T_FMT ", byte %i: %s\n",
"IOERROR: %s: error reading chunk at offset " OFF_T_FMT ", byte %i: %s",
name, chunk->offset, prot_bytes_in(in), error);

if (out)
Expand Down
6 changes: 3 additions & 3 deletions backup/lcb_indexr.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ EXPORTED int backup_get_mailbox_id(struct backup *backup, const char *uniqueid)
int r = sqldb_exec(backup->db, backup_index_mailbox_select_uniqueid_sql,
bval, _get_mailbox_id_cb, &id);
if (r) {
syslog(LOG_ERR, "%s: something went wrong: %i %s\n",
syslog(LOG_ERR, "%s: something went wrong: %i %s",
__func__, r, uniqueid);
}

Expand Down Expand Up @@ -784,7 +784,7 @@ EXPORTED int backup_get_message_id(struct backup *backup, const char *guid)
int r = sqldb_exec(backup->db, backup_index_message_select_guid_sql, bval,
_get_message_id_cb, &id);
if (r) {
syslog(LOG_ERR, "%s: something went wrong: %i %s\n",
syslog(LOG_ERR, "%s: something went wrong: %i %s",
__func__, r, guid);
return -1;
}
Expand Down Expand Up @@ -857,7 +857,7 @@ EXPORTED struct backup_message *backup_get_message(struct backup *backup,
int r = sqldb_exec(backup->db, backup_index_message_select_guid_sql, bval,
_message_row_cb, &mrock);
if (r) {
syslog(LOG_ERR, "%s: something went wrong: %i %s\n",
syslog(LOG_ERR, "%s: something went wrong: %i %s",
__func__, r, message_guid_encode(guid));
if (bm) backup_message_free(&bm);
return NULL;
Expand Down
50 changes: 25 additions & 25 deletions backup/lcb_indexw.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ HIDDEN int backup_index(struct backup *backup, struct dlist *dlist,
else if (config_debug) {
struct buf tmp = BUF_INITIALIZER;
dlist_printbuf(dlist, 1, &tmp);
syslog(LOG_DEBUG, "ignoring unrecognised dlist: %s\n", buf_cstring(&tmp));
syslog(LOG_DEBUG, "ignoring unrecognised dlist: %s", buf_cstring(&tmp));
buf_free(&tmp);
}

Expand All @@ -111,7 +111,7 @@ HIDDEN int backup_index(struct backup *backup, struct dlist *dlist,
static int _index_expunge(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset)
{
syslog(LOG_DEBUG, "indexing EXPUNGE at " OFF_T_FMT "...\n", dl_offset);
syslog(LOG_DEBUG, "indexing EXPUNGE at " OFF_T_FMT "...", dl_offset);

const char *mboxname;
const char *uniqueid;
Expand Down Expand Up @@ -184,7 +184,7 @@ static int _get_magic_flags(struct dlist *flags, int *is_expunged)
static int _index_mailbox(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset)
{
syslog(LOG_DEBUG, "indexing MAILBOX at " OFF_T_FMT "...\n", dl_offset);
syslog(LOG_DEBUG, "indexing MAILBOX at " OFF_T_FMT "...", dl_offset);

const char *uniqueid = NULL;
const char *mboxname = NULL;
Expand Down Expand Up @@ -285,12 +285,12 @@ static int _index_mailbox(struct backup *backup, struct dlist *dl,
r = sqldb_exec(backup->db, backup_index_mailbox_insert_sql,
mbox_bval, NULL, NULL);
if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i insert %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i insert %s",
__func__, r, mboxname);
}
}
else if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i update %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i update %s",
__func__, r, mboxname);
}

Expand Down Expand Up @@ -329,15 +329,15 @@ static int _index_mailbox(struct backup *backup, struct dlist *dl,
/* XXX should this search for guid+size rather than just guid? */
message_id = backup_get_message_id(backup, guid);
if (message_id == -1) {
syslog(LOG_DEBUG, "%s: something went wrong: %i %s %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i %s %s",
__func__, r, mboxname, guid);
goto error;
}
if (message_id == 0) {
/* can't link this record, we don't have a message */
/* possibly we're in compact, and have deleted it? */
/* XXX this should probably be an error too, but can't be until compact is smarter */
syslog(LOG_DEBUG, "%s: skipping %s record for %s: message not found\n",
syslog(LOG_DEBUG, "%s: skipping %s record for %s: message not found",
__func__, mboxname, guid);
continue;
}
Expand All @@ -349,13 +349,13 @@ static int _index_mailbox(struct backup *backup, struct dlist *dl,
_get_magic_flags(flags, &is_expunged);

if (is_expunged) {
syslog(LOG_DEBUG, "%s: found expunge flag for message %s\n",
syslog(LOG_DEBUG, "%s: found expunge flag for message %s",
__func__, guid);
expunged = ts;
}

dlist_printbuf(flags, 0, &flags_buf);
syslog(LOG_DEBUG, "%s: found flags for message %s: %s\n",
syslog(LOG_DEBUG, "%s: found flags for message %s: %s",
__func__, guid, buf_cstring(&flags_buf));
}

Expand Down Expand Up @@ -393,12 +393,12 @@ static int _index_mailbox(struct backup *backup, struct dlist *dl,
r = sqldb_exec(backup->db, backup_index_mailbox_message_insert_sql,
record_bval, NULL, NULL);
if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i insert %s %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i insert %s %s",
__func__, r, mboxname, guid);
}
}
else if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i update %s %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i update %s %s",
__func__, r, mboxname, guid);
}

Expand All @@ -409,12 +409,12 @@ static int _index_mailbox(struct backup *backup, struct dlist *dl,
}
}

syslog(LOG_DEBUG, "%s: committing index change: %s\n", __func__, mboxname);
syslog(LOG_DEBUG, "%s: committing index change: %s", __func__, mboxname);
sqldb_commit(backup->db, __func__);
return 0;

error:
syslog(LOG_DEBUG, "%s: rolling back index change: %s\n", __func__, mboxname);
syslog(LOG_DEBUG, "%s: rolling back index change: %s", __func__, mboxname);
sqldb_rollback(backup->db, __func__);

return IMAP_INTERNAL;
Expand All @@ -423,7 +423,7 @@ static int _index_mailbox(struct backup *backup, struct dlist *dl,
static int _index_unmailbox(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset)
{
syslog(LOG_DEBUG, "indexing UNMAILBOX at " OFF_T_FMT "...\n", dl_offset);
syslog(LOG_DEBUG, "indexing UNMAILBOX at " OFF_T_FMT "...", dl_offset);

const char *mboxname = dl->sval;

Expand All @@ -436,7 +436,7 @@ static int _index_unmailbox(struct backup *backup, struct dlist *dl,
int r = sqldb_exec(backup->db, backup_index_mailbox_delete_sql, bval, NULL,
NULL);
if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i %s",
__func__, r, mboxname);
}

Expand All @@ -446,7 +446,7 @@ static int _index_unmailbox(struct backup *backup, struct dlist *dl,
static int _index_message(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset, size_t dl_len)
{
syslog(LOG_DEBUG, "indexing MESSAGE at " OFF_T_FMT " (" SIZE_T_FMT " bytes)...\n", dl_offset, dl_len);
syslog(LOG_DEBUG, "indexing MESSAGE at " OFF_T_FMT " (" SIZE_T_FMT " bytes)...", dl_offset, dl_len);
(void) ts;

struct dlist *di;
Expand Down Expand Up @@ -477,12 +477,12 @@ static int _index_message(struct backup *backup, struct dlist *dl,
r = sqldb_exec(backup->db, backup_index_message_insert_sql, bval,
NULL, NULL);
if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i insert message %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i insert message %s",
__func__, r, message_guid_encode(guid));
}
}
else if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i update message %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i update message %s",
__func__, r, message_guid_encode(guid));
}
}
Expand All @@ -493,7 +493,7 @@ static int _index_message(struct backup *backup, struct dlist *dl,
static int _index_rename(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset)
{
syslog(LOG_DEBUG, "indexing RENAME at " OFF_T_FMT "\n", dl_offset);
syslog(LOG_DEBUG, "indexing RENAME at " OFF_T_FMT, dl_offset);
(void) ts;

const char *uniqueid = NULL;
Expand Down Expand Up @@ -529,7 +529,7 @@ static int _index_rename(struct backup *backup, struct dlist *dl,
mbox_bval, NULL, NULL);

if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i rename %s => %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i rename %s => %s",
__func__, r, oldmboxname, newmboxname);
}

Expand All @@ -539,7 +539,7 @@ static int _index_rename(struct backup *backup, struct dlist *dl,
static int _index_seen(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset)
{
syslog(LOG_DEBUG, "indexing %s at " OFF_T_FMT "\n", dl->name, dl_offset);
syslog(LOG_DEBUG, "indexing %s at " OFF_T_FMT, dl->name, dl_offset);
(void) ts;

const char *uniqueid;
Expand Down Expand Up @@ -577,7 +577,7 @@ static int _index_seen(struct backup *backup, struct dlist *dl,
r = sqldb_exec(backup->db, backup_index_seen_insert_sql, bval,
NULL, NULL);
if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i insert seen %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i insert seen %s",
__func__, r, uniqueid);
}
}
Expand All @@ -592,7 +592,7 @@ static int _index_seen(struct backup *backup, struct dlist *dl,
static int _index_sub(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset)
{
syslog(LOG_DEBUG, "indexing %s at " OFF_T_FMT "\n", dl->name, dl_offset);
syslog(LOG_DEBUG, "indexing %s at " OFF_T_FMT, dl->name, dl_offset);

const char *mboxname = NULL;
int r;
Expand Down Expand Up @@ -623,7 +623,7 @@ static int _index_sub(struct backup *backup, struct dlist *dl,
r = sqldb_exec(backup->db, backup_index_subscription_insert_sql, bval,
NULL, NULL);
if (r) {
syslog(LOG_DEBUG, "%s: something went wrong: %i insert subscription %s\n",
syslog(LOG_DEBUG, "%s: something went wrong: %i insert subscription %s",
__func__, r, mboxname);
}
}
Expand All @@ -638,7 +638,7 @@ static int _index_sub(struct backup *backup, struct dlist *dl,
static int _index_sieve(struct backup *backup, struct dlist *dl,
time_t ts, off_t dl_offset)
{
syslog(LOG_DEBUG, "indexing %s at " OFF_T_FMT "\n", dl->name, dl_offset);
syslog(LOG_DEBUG, "indexing %s at " OFF_T_FMT, dl->name, dl_offset);

const char *filename;
int r;
Expand Down
20 changes: 10 additions & 10 deletions backup/lcb_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int verify_chunk_checksums(struct backup *backup, struct backup_chunk *ch
sha1_file(backup->fd, backup->data_fname, chunk->offset, file_sha1);
r = strncmp(chunk->file_sha1, file_sha1, sizeof(file_sha1));
if (r) {
syslog(LOG_DEBUG, "%s: %s (chunk %d) file checksum mismatch: %s on disk, %s in index\n",
syslog(LOG_DEBUG, "%s: %s (chunk %d) file checksum mismatch: %s on disk, %s in index",
__func__, backup->data_fname, chunk->id, file_sha1, chunk->file_sha1);
if (out)
fprintf(out, "file checksum mismatch for chunk %d: %s on disk, %s in index\n",
Expand Down Expand Up @@ -157,7 +157,7 @@ static int verify_chunk_checksums(struct backup *backup, struct backup_chunk *ch
if (len != chunk->length) {
syslog(LOG_DEBUG, "%s: %s (chunk %d) data length mismatch: "
SIZE_T_FMT " on disk,"
SIZE_T_FMT " in index\n",
SIZE_T_FMT " in index",
__func__, backup->data_fname, chunk->id, len, chunk->length);
if (out)
fprintf(out, "data length mismatch for chunk %d: "
Expand All @@ -177,7 +177,7 @@ static int verify_chunk_checksums(struct backup *backup, struct backup_chunk *ch
assert(r == 2 * SHA1_DIGEST_LENGTH);
r = strncmp(chunk->data_sha1, data_sha1, sizeof(data_sha1));
if (r) {
syslog(LOG_DEBUG, "%s: %s (chunk %d) data checksum mismatch: %s on disk, %s in index\n",
syslog(LOG_DEBUG, "%s: %s (chunk %d) data checksum mismatch: %s on disk, %s in index",
__func__, backup->data_fname, chunk->id, data_sha1, chunk->data_sha1);
if (out)
fprintf(out, "data checksum mismatch for chunk %d: %s on disk, %s in index\n",
Expand All @@ -186,7 +186,7 @@ static int verify_chunk_checksums(struct backup *backup, struct backup_chunk *ch
}

done:
syslog(LOG_DEBUG, "%s: checksum %s!\n", __func__, r ? "failed" : "passed");
syslog(LOG_DEBUG, "%s: checksum %s!", __func__, r ? "failed" : "passed");
if (out && verbose)
fprintf(out, "%s\n", r ? "error" : "ok");
return r;
Expand Down Expand Up @@ -330,7 +330,7 @@ static int verify_chunk_messages(struct backup *backup, struct backup_chunk *chu
dlist_free(&vmrock.cached_dlist);
}

syslog(LOG_DEBUG, "%s: chunk %d %s!\n", __func__, chunk->id,
syslog(LOG_DEBUG, "%s: chunk %d %s!", __func__, chunk->id,
r ? "failed" : "passed");
if (out && verbose)
fprintf(out, "%s\n", r ? "error" : "ok");
Expand Down Expand Up @@ -407,7 +407,7 @@ static int mailbox_matches(const struct backup_mailbox *mailbox,
if (synccrcs.annot != mailbox->sync_crc_annot)
return 0;

syslog(LOG_DEBUG, "%s: %s matches!\n", __func__, mailbox->uniqueid);
syslog(LOG_DEBUG, "%s: %s matches!", __func__, mailbox->uniqueid);
return 1;
}

Expand Down Expand Up @@ -440,7 +440,7 @@ static int mailbox_message_matches(const struct backup_mailbox_message *mailbox_
|| !message_guid_equal(guid, &mailbox_message->guid))
return 0;

syslog(LOG_DEBUG, "%s: %s:%u matches!\n", __func__,
syslog(LOG_DEBUG, "%s: %s:%u matches!", __func__,
mailbox_message->mailbox_uniqueid, mailbox_message->uid);
return 1;
}
Expand Down Expand Up @@ -611,7 +611,7 @@ static int verify_chunk_mailbox_links(struct backup *backup, struct backup_chunk
/* anything left in either of the lists is missing from the chunk data. bad! */
mailbox = mailbox_list->head;
while (mailbox) {
syslog(LOG_DEBUG, "%s: chunk %d missing mailbox data for %s (%s)\n",
syslog(LOG_DEBUG, "%s: chunk %d missing mailbox data for %s (%s)",
__func__, chunk->id, mailbox->uniqueid, mailbox->mboxname);
if (out)
fprintf(out, "chunk %d missing mailbox data for %s (%s)\n",
Expand All @@ -621,7 +621,7 @@ static int verify_chunk_mailbox_links(struct backup *backup, struct backup_chunk

mailbox_message = mailbox_message_list->head;
while (mailbox_message) {
syslog(LOG_DEBUG, "%s: chunk %d missing mailbox_message data for %s uid %u\n",
syslog(LOG_DEBUG, "%s: chunk %d missing mailbox_message data for %s uid %u",
__func__, chunk->id, mailbox_message->mailbox_uniqueid,
mailbox_message->uid);
if (out)
Expand All @@ -643,7 +643,7 @@ static int verify_chunk_mailbox_links(struct backup *backup, struct backup_chunk
backup_mailbox_message_list_empty(mailbox_message_list);
free(mailbox_message_list);

syslog(LOG_DEBUG, "%s: chunk %d %s!\n", __func__, chunk->id,
syslog(LOG_DEBUG, "%s: chunk %d %s!", __func__, chunk->id,
r ? "failed" : "passed");
if (out && verbose)
fprintf(out, "%s\n", r ? "error" : "ok");
Expand Down
Loading

0 comments on commit 31158d0

Please sign in to comment.