Skip to content

Commit 6b55762

Browse files
committed
build: Fix compilation errors with GCC 16.
* Fix unused-but-set-variable errors. * net_nntp: Fix snprintf format-truncation error.
1 parent 499fdaf commit 6b55762

File tree

8 files changed

+13
-17
lines changed

8 files changed

+13
-17
lines changed

bbs/auth.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ static int valid_temp_token(const char *username, const char *password)
426426
{
427427
struct pw_auth_token *t;
428428
time_t now;
429-
int total = 0;
430429
int match = 0;
431430

432431
now = time(NULL);
@@ -447,7 +446,6 @@ static int valid_temp_token(const char *username, const char *password)
447446
}
448447
/* Don't break, we still want to purge any tokens that may be stale. */
449448
}
450-
total++;
451449
}
452450
RWLIST_TRAVERSE_SAFE_END;
453451
RWLIST_UNLOCK(&auth_tokens);

bbs/socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,10 +2400,10 @@ ssize_t bbs_timed_read(int fd, char *restrict buf, size_t len, int ms)
24002400
len -= (long unsigned) res;
24012401
if (len <= 0) {
24022402
bbs_debug(7, "Buffer (size %lu) is now full\n", len);
2403-
return res;
2403+
return bytes;
24042404
}
24052405
if (bbs_poll(fd, ms) <= 0) {
2406-
return res;
2406+
return bytes;
24072407
}
24082408
}
24092409
__builtin_unreachable();

external/modman.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ static int check_header_file(const char *dirname, const char *modname, int is_mo
404404
char incpaths[sizeof(sys_include_paths)];
405405
int exists = 0;
406406
char *path, *paths = incpaths;
407-
int num_incpaths = 0;
408407
char filename[1024];
409408
int common_include_file = 0;
410409

@@ -428,7 +427,6 @@ static int check_header_file(const char *dirname, const char *modname, int is_mo
428427

429428
includedir = strchr(path, '/'); /* Skip leading whitespace, and strchr cannot return NULL. */
430429
TERMINATE_AT(path, '\n');
431-
num_incpaths++;
432430

433431
snprintf(filename, sizeof(filename), "%s/%s", includedir, incfile);
434432
modman_log(8, " Checking existence of %s\n", filename);

modules/mod_smtp_filter_arc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ static ARC_LIB *lib;
3434
static int process_message(struct smtp_filter_data *f, ARC_MESSAGE *msg)
3535
{
3636
ARC_STAT stat;
37-
size_t headerslen, bodylen;
37+
size_t headerslen;
38+
#ifdef EXTRA_CHECKS
39+
size_t bodylen;
40+
#endif
3841
char *headers, *header, *dup = NULL;
3942
char full_header[4096];
4043
char *hdrbuf;
@@ -102,10 +105,14 @@ static int process_message(struct smtp_filter_data *f, ARC_MESSAGE *msg)
102105
}
103106

104107
body = smtp_message_body(f) + headerslen;
108+
#ifdef EXTRA_CHECKS
105109
bodylen = f->size - headerslen;
110+
#endif
106111
if (STARTS_WITH(body, "\r\n\r\n")) {
107112
body += 2;
113+
#ifdef EXTRA_CHECKS
108114
bodylen -= 2;
115+
#endif
109116
}
110117
#ifdef EXTRA_CHECKS
111118
bbs_assert(strlen(body) == bodylen);

nets/net_imap.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4935,20 +4935,17 @@ static int imap_process(struct imap_session *imap, char *s, char *saved_tag, siz
49354935
res = handle_setacl(imap, s, 1);
49364936
} else if (!strcasecmp(command, "ENABLE")) {
49374937
char *cap;
4938-
int enabled = 0;
49394938
REQUIRE_ARGS(s);
49404939
/*! \todo This combined with our parsing of remote server capabilities could use a more formal capabilities flag-based int */
49414940
while ((cap = strsep(&s, " "))) {
49424941
/* The reply only contains capabilities that were enabled just now, not any that may have already been enabled. */
49434942
if (!strcasecmp(cap, "CONDSTORE")) {
49444943
imap->condstore = 1;
49454944
imap_send(imap, "ENABLED CONDSTORE");
4946-
enabled++;
49474945
} else if (!strcasecmp(cap, "QRESYNC")) {
49484946
imap->condstore = 1; /* Implicitly includes CONDSTORE */
49494947
imap->qresync = 1;
49504948
imap_send(imap, "ENABLED QRESYNC CONDSTORE");
4951-
enabled++;
49524949
} else {
49534950
bbs_warning("Unknown capability %s\n", cap);
49544951
}

nets/net_imap/imap_client_list.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ int list_virtual(struct imap_session *imap, struct list_command *lcmd)
326326
FILE *fp;
327327
char virtfile[256];
328328
char line[256];
329-
int l = 0;
330329
struct bbs_parallel p;
331330
int lineno = 0;
332331
int skip_proxied = 0;
@@ -465,7 +464,6 @@ int list_virtual(struct imap_session *imap, struct list_command *lcmd)
465464
break; /* If we're excluding all proxied accounts from the LIST response, we can stop now */
466465
}
467466

468-
l++;
469467
server = line;
470468
prefix = strsep(&server, "|"); /* Use pipe in case mailbox name contains spaces */
471469
if (!strncmp(prefix, "#", 1)) {

nets/net_nntp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ static char *get_article_id(struct nntp_session *nntp, int number)
398398
static int on_head(const char *dir_name, const char *filename, struct nntp_session *nntp, int number, int msgfilter, const char *msgidfilter)
399399
{
400400
FILE *fp;
401-
char fullpath[256];
401+
char fullpath[256 * 3];
402402
const char *msgid;
403403
char msgbuf[1001]; /* Enough for longest possible line */
404404

tests/test.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ static void *io_relay(void *varg)
464464
soft_assertions_failed++;
465465
}
466466
if (bbs_expect_str) {
467-
int rounds = 0;
468467
bbs_readline_append(&rldata, "\n", buf, (size_t) res, &ready);
469468
/* Check if the line contains the expected output.
470469
* If we read multiple lines, loop until there's not a full line left in the buffer. */
@@ -484,7 +483,6 @@ static void *io_relay(void *varg)
484483
}
485484
/* Don't append, just shift the buffer and check if we can read immediately. */
486485
bbs_readline_append(&rldata, "\n", NULL, 0, &ready);
487-
rounds++;
488486
}
489487
if (startup_run_unit_tests_started == 1) {
490488
bbs_debug(5, "Stalling until expect reactivated\n");
@@ -1237,8 +1235,8 @@ static int run_test(const char *filename, int multiple)
12371235
alarm(0); /* Cancel any pending alarm */
12381236
bbs_debug(3, "Test '%s' returned %d\n", filename, res);
12391237
#if 1
1240-
/* Allow the poor BBS time for catching its breath.
1241-
* test_irc under valgrind no longer seems to need this due to locking fixes, but LBBS-80 is exacerbated by removing this */
1238+
/* Allow the poor BBS time for catching its breath. */
1239+
/* FIXME test_irc under valgrind no longer seems to need this due to locking fixes, but LBBS-80 is exacerbated by removing this */
12421240
usleep(50000);
12431241
#endif
12441242
} else {

0 commit comments

Comments
 (0)