diff options
| author | Paul Eggert | 2017-05-17 10:27:31 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-05-17 10:59:02 -0700 |
| commit | 937ff1a0af1813875f851987ca5c4ac833ca3c97 (patch) | |
| tree | dfbd505308ef5aff4da0bd4a75c9cfdce5889023 /src/process.c | |
| parent | 2b93b754c108f620428eaf9b193eeb321f3010db (diff) | |
| download | emacs-937ff1a0af1813875f851987ca5c4ac833ca3c97.tar.gz emacs-937ff1a0af1813875f851987ca5c4ac833ca3c97.zip | |
Catch IPv4/IPv6 issues at compile time
* src/process.c (connect_network_socket): Use verify,
not eassert, so that any problems are caught at compile-time.
Avoid dodgy cast by using a local var of the correct type.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/process.c b/src/process.c index ecb1b0ca6df..8180feaba9a 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3430,11 +3430,11 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, | |||
| 3430 | /* The code below assumes the port is at the same offset | 3430 | /* The code below assumes the port is at the same offset |
| 3431 | and of the same width in both IPv4 and IPv6 | 3431 | and of the same width in both IPv4 and IPv6 |
| 3432 | structures, but the standards don't guarantee that, | 3432 | structures, but the standards don't guarantee that, |
| 3433 | so we have this assertion to make sure. */ | 3433 | so verify it here. */ |
| 3434 | eassert ((offsetof (struct sockaddr_in, sin_port) | 3434 | struct sockaddr_in6 sa6; |
| 3435 | == offsetof (struct sockaddr_in6, sin6_port)) | 3435 | verify ((offsetof (struct sockaddr_in, sin_port) |
| 3436 | && (sizeof (sa1.sin_port) | 3436 | == offsetof (struct sockaddr_in6, sin6_port)) |
| 3437 | == sizeof (((struct sockaddr_in6 *) &sa1)->sin6_port))); | 3437 | && sizeof (sa1.sin_port) == sizeof (sa6.sin6_port)); |
| 3438 | #endif | 3438 | #endif |
| 3439 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) | 3439 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) |
| 3440 | { | 3440 | { |