[git] NTBTLS - branch, master, updated. ntbtls-0.1.2-17-gac406d3
[email protected] (by NIIBE Yutaka) Thu, 08 Nov 2018 22:32:11 +0100
| Newsgroups | gmane.comp.encryption.gpg.cvs |
|---|---|
| Message-ID | <[email protected]> |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Not Too Bad TLS".
The branch, master has been updated
via ac406d38e49d4bbe2c6b41680abf7c717ce9b393 (commit)
from 4b7c6a91f56c2bd5baa859146298f8f20519313f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ac406d38e49d4bbe2c6b41680abf7c717ce9b393
Author: NIIBE Yutaka <[email protected]>
Date: Fri Nov 9 06:21:25 2018 +0900
ntbtls-cli: Use union to access hostent addr.
* src/ntbtls-cli.c (connect_server): Use union.
--
Unfortunately, the API of gethostbyname was designed in old style of
C. Modern compiler emits warnings for its access to h_addr of char *
on a machine of different alignment requirement for other
objects. (It should be defined as void *, in new style.)
As a workaround, we use union here.
Signed-off-by: NIIBE Yutaka <[email protected]>
diff --git a/src/ntbtls-cli.c b/src/ntbtls-cli.c
index 67affc1..555961b 100644
--- a/src/ntbtls-cli.c
+++ b/src/ntbtls-cli.c
@@ -200,6 +200,10 @@ connect_server (const char *server, unsigned short port)
int sock = -1;
struct sockaddr_in addr;
struct hostent *host;
+ union {
+ char *addr;
+ struct in_addr *in_addr;
+ } addru;
addr.sin_family = AF_INET;
addr.sin_port = htons (port);
@@ -211,7 +215,8 @@ connect_server (const char *server, unsigned short port)
return -1;
}
- addr.sin_addr = *(struct in_addr*)host->h_addr;
+ addru.addr = host->h_addr;
+ addr.sin_addr = *addru.in_addr;
sock = socket (AF_INET, SOCK_STREAM, 0);
if (sock == -1)
-----------------------------------------------------------------------
Summary of changes:
src/ntbtls-cli.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
hooks/post-receive
--
Not Too Bad TLS
http://git.gnupg.org