]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
portability: fix socket size initialisation (fixes tests on alpine)
authorBaptiste Daroussin <bapt@FreeBSD.org>
Tue, 27 May 2025 08:04:40 +0000 (10:04 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Tue, 27 May 2025 08:04:40 +0000 (10:04 +0200)
tests/mlmmj.c

index 6c40cff858a4829e969b775b56f5c407eb09fa6c..48a743aabf3e44795d85b169be11774b85341f0a 100644 (file)
@@ -257,7 +257,7 @@ ATF_TC_BODY(init_sock, tc)
                int s = fakesmtp(mypipe[1]);
                int c;
                struct sockaddr_in cl;
-               socklen_t clsize = 0;
+               socklen_t clsize = sizeof(struct sockaddr_in);
                /*
                 * Now we can accept incoming connections one
                 * at a time using accept(2).
@@ -1005,7 +1005,7 @@ ATF_TC_BODY(init_smtp, tc)
                int s = fakesmtp(smtppipe[1]);
                int c;
                struct sockaddr_in cl;
-               socklen_t clsize = 0;
+               socklen_t clsize = sizeof(struct sockaddr_in);
                c = accept(s, (struct sockaddr *) &cl, &clsize);
                if (c == -1)
                        err(5, "accept()");
@@ -1045,7 +1045,7 @@ ATF_TC_BODY(smtp_bad_greetings, tc)
                int s = fakesmtp(smtppipe[1]);
                int c;
                struct sockaddr_in cl;
-               socklen_t clsize = 0;
+               socklen_t clsize = sizeof(struct sockaddr_in);
                c = accept(s, (struct sockaddr *) &cl, &clsize);
                if (c == -1)
                        err(5, "accept()");
@@ -1070,7 +1070,7 @@ ATF_TC_BODY(smtp_bad_ehlo, tc)
                int s = fakesmtp(smtppipe[1]);
                int c;
                struct sockaddr_in cl;
-               socklen_t clsize = 0;
+               socklen_t clsize = sizeof(struct sockaddr_in);
                c = accept(s, (struct sockaddr *) &cl, &clsize);
                if (c == -1)
                        err(5, "accept()");
@@ -1097,7 +1097,7 @@ ATF_TC_BODY(smtp_no_ehlo, tc)
                int s = fakesmtp(smtppipe[1]);
                int c;
                struct sockaddr_in cl;
-               socklen_t clsize = 0;
+               socklen_t clsize = sizeof(struct sockaddr_in);
                c = accept(s, (struct sockaddr *) &cl, &clsize);
                if (c == -1)
                        err(5, "accept()");
@@ -2100,7 +2100,7 @@ ATF_TC_BODY(newsmtp, tc)
                int s = fakesmtp(smtppipe[1]);
                int c;
                struct sockaddr_in cl;
-               socklen_t clsize = 0;
+               socklen_t clsize = sizeof(struct sockaddr_in);
                c = accept(s, (struct sockaddr *) &cl, &clsize);
                if (c == -1)
                        err(5, "accept()");