While here, remove GNU extension only initialisation.
void init_sockfd(int *sockfd, const char *relayhost, unsigned short port)
{
int on, sd = -1;
- struct addrinfo *ai = NULL, *curai, hints;
+ struct addrinfo *ai = NULL, *curai, hints = { 0 };
char srv[NI_MAXSERV];
*sockfd = -1;
- memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = PF_UNSPEC;
snprintf(srv, sizeof(srv), "%d", port);
char *probefile;
int fd;
time_t t;
- struct mail mail;
+ struct mail mail = { 0 };
- memset(&mail, 0, sizeof(mail));
myaddr = lowercase(addr);
gen_addr_cookie(from, ml, "bounces-probe-", myaddr)
strlist stl = tll_init();
unsigned short smtpport;
struct sigaction sigact;
- struct mail mail;
+ struct mail mail = { 0 };
struct ml ml;
int subdirfd, mailfd;
- memset(&mail, 0, sizeof(mail));
log_set_name(argv[0]);
ml_init(&ml);
send_help(struct ml *ml, const char *queuefilename, const char *emailaddr)
{
char *fromaddr;
- struct mail mail;
+ struct mail mail = { 0 };
- memset(&mail, 0, sizeof(mail));
gen_addr(fromaddr, ml, "bounces-help");
mail.to = emailaddr;
char *randomstr = NULL, *confirmaddr;
const char *tmpstr, *listtext;
int fd = openat(ml->fd, sub ? "subconf" : "unsubconf", O_DIRECTORY|O_CLOEXEC);
- struct mail mail;
+ struct mail mail = { 0 };
- memset(&mail, 0, sizeof(mail));
if (fd == -1) {
log_error(LOG_ARGS, "Cound not open(%s/%s)", ml->dir,
sub ? "subconf" : "unsubconf");
int s, c;
FILE *f;
socklen_t clsize = 0;
- struct sockaddr_in me, cl;
+ struct sockaddr_in me = { 0 }, cl;
char *line = NULL;
size_t linecap = 0;
int mailnum = 0;
exit(1);
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &(int) { 1 }, sizeof(int)) != 0)
exit(2);
- memset(&me, 0, sizeof(me));
me.sin_family = AF_INET;
me.sin_addr.s_addr = inet_addr("127.0.0.1");
/* specific interface */
ATF_TC_BODY(send_mail_basics, tc)
{
- struct mail mail = {};
+ struct mail mail = { 0 };
ATF_REQUIRE_EQ_MSG(send_mail(1, &mail, -1, -1, false), 0, "Failure with to == NULL");
mail.to = "plop";
ATF_REQUIRE_EQ_MSG(send_mail(1, &mail, -1, -1, false), 0, "Failure with to without @");
ATF_TC_BODY(send_mail, tc)
{
int smtppipe[2];
- struct mail mail = {};
+ struct mail mail = { 0 };
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
ATF_TC_BODY(save_queue, tc)
{
- struct mail mail = {};
+ struct mail mail = { 0 };
mail.to = "plop";
mail.from = "bla";
struct ml ml;
ml_init(&ml);
ml.dir = "list";
- struct mail mail = {};
+ struct mail mail = { 0 };
ATF_REQUIRE_MSG(ml_open(&ml, false), "impossible to open the mailing list");
atf_utils_create_file("list/control/smtpport", "25678");
int smtppipe[2];
fakesmtp(int pipe)
{
int s;
- struct sockaddr_in me;
+ struct sockaddr_in me = { 0 };
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
exit(1);
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &(int) { 1 }, sizeof(int)) != 0)
exit(2);
- memset(&me, 0, sizeof(me));
me.sin_family = AF_INET;
me.sin_addr.s_addr = inet_addr("127.0.0.1");
/* specific interface */