Looks good and is the right thing to do. The rest of smtp-dummy uses parens around sizeof operands, but whatever.
It's probably not necessary to clear peer_addr, since it's an out-argument of accept and is never used (plus the example in bind(2) doesn't), but there's no harm. Quoth Tomi Ollila on Nov 11 at 1:32 am: > Any junk bytes in sockaddr_in structures before passing those > to bind() or accept() functions may cause problems. > --- > test/smtp-dummy.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/test/smtp-dummy.c b/test/smtp-dummy.c > index 9da8202..38d1d62 100644 > --- a/test/smtp-dummy.c > +++ b/test/smtp-dummy.c > @@ -159,6 +159,7 @@ main (int argc, char *argv[]) > return 1; > } > > + memset (&addr, 0, sizeof addr); > addr.sin_family = AF_INET; > addr.sin_port = htons (25025); > addr.sin_addr = *(struct in_addr *) hostinfo->h_addr; > @@ -178,6 +179,7 @@ main (int argc, char *argv[]) > return 1; > } > > + memset (&peer_addr, 0, sizeof peer_addr); > peer_addr_len = sizeof (peer_addr); > peer = accept (sock, (struct sockaddr *) &peer_addr, &peer_addr_len); > if (peer == -1) { _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch