From: Philipp Stephani <p.stephani2@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Philipp Stephani <phst@google.com>, emacs-devel@gnu.org
Subject: Re: [PATCH] Fix use of sockaddr_in
Date: Sun, 14 May 2017 19:06:26 +0000 [thread overview]
Message-ID: <CAArVCkSX1Veb+PQ=QnMHfkuy2LEqagiPazrGw017QrHcav39zg@mail.gmail.com> (raw)
In-Reply-To: <m3vap391gb.fsf@stories>
[-- Attachment #1: Type: text/plain, Size: 974 bytes --]
Lars Ingebrigtsen <larsi@gnus.org> schrieb am So., 14. Mai 2017 um
12:28 Uhr:
> Philipp Stephani <p.stephani2@gmail.com> writes:
>
> > + case AF_INET:
> > + port = ((struct sockaddr_in6 *) (struct sockaddr
> *) &sa1)->sin6_port;
> > + has_port = true;
> > + break;
> > + case AF_INET6:
> > + port = ((struct sockaddr_in *) (struct sockaddr
> *) &sa1)->sin_port;
> > + has_port = true;
>
> Aren't these two cases in reverse? If it's AF_INET6, it's an in6
> struct, not the other way around.
>
Oops, thanks!
>
> Not that it matters, since (as Eli said) the sizes of the first elements
> in the structs are identical...
>
>
I don't know whether we can rely on that (i.e. whether Posix guarantees it)
or whether it's an implementation detail.
(This also needs __attribute__((may_alias)), type punning, or memcpy due to
aliasing.)
[-- Attachment #2: Type: text/html, Size: 1640 bytes --]
prev parent reply other threads:[~2017-05-14 19:06 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-07 3:40 building/using address-sanitizer-enabled emacs? Jim Meyering
2017-05-07 19:54 ` Paul Eggert
2017-05-07 21:44 ` Jim Meyering
2017-05-08 2:36 ` Eli Zaretskii
2017-05-08 5:42 ` Paul Eggert
2017-05-08 14:39 ` Eli Zaretskii
2017-05-08 14:46 ` Paul Eggert
2017-05-08 16:04 ` Eli Zaretskii
2017-05-09 5:48 ` Jim Meyering
2017-05-09 15:18 ` Eli Zaretskii
2017-05-09 17:06 ` Jim Meyering
2017-05-09 17:45 ` Eli Zaretskii
2017-05-09 19:22 ` Paul Eggert
2017-05-09 22:49 ` Jim Meyering
2017-05-10 2:41 ` Eli Zaretskii
2017-05-16 21:49 ` Paul Eggert
2017-05-17 2:24 ` Eli Zaretskii
2017-05-17 14:46 ` Paul Eggert
2017-05-17 16:06 ` Eli Zaretskii
2017-05-17 20:05 ` Paul Eggert
2017-05-18 4:15 ` Eli Zaretskii
2017-05-09 23:15 ` Philipp Stephani
2017-05-10 2:42 ` Eli Zaretskii
2017-05-10 22:24 ` Philipp Stephani
2017-05-13 8:02 ` Eli Zaretskii
2017-05-13 15:08 ` [PATCH] Fix use of sockaddr_in Philipp Stephani
2017-05-13 16:52 ` Eli Zaretskii
2017-05-13 19:14 ` Andreas Schwab
2017-05-13 19:29 ` Eli Zaretskii
2017-05-13 20:05 ` Andreas Schwab
2017-05-14 2:32 ` Eli Zaretskii
2017-05-14 6:11 ` Andreas Schwab
2017-05-14 14:20 ` Eli Zaretskii
2017-05-15 6:15 ` Paul Eggert
2017-05-15 9:04 ` Philipp Stephani
2017-05-17 20:38 ` Paul Eggert
2017-05-27 11:35 ` Philipp Stephani
2017-05-17 15:16 ` Eli Zaretskii
2017-05-17 20:15 ` Paul Eggert
2017-05-14 10:28 ` Lars Ingebrigtsen
2017-05-14 19:06 ` Philipp Stephani [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAArVCkSX1Veb+PQ=QnMHfkuy2LEqagiPazrGw017QrHcav39zg@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=phst@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).