mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
"sizeof(sun->sun_path)" is not always the same as "sizeof(addr->u.sockname)"
on all platforms; because of that BUILD_ASSERT was failing on macOS. (on macOS "sizeof(sun->sun_path) == 104" and "sizeof(addr->u.sockname) == 108") [ Linux man page says it can be as small as 92, so let's use the real value. I also cleaned up the incorrect comment order on that struct! --RR ] Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
c33bbb2639
commit
855d0b9401
@ -8,9 +8,7 @@
|
||||
#include <common/wireaddr.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
/* Returns false if we didn't parse it, and *cursor == NULL if malformed. */
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
struct in6_addr;
|
||||
struct in_addr;
|
||||
@ -87,12 +89,12 @@ enum wireaddr_internal_type {
|
||||
struct wireaddr_internal {
|
||||
enum wireaddr_internal_type itype;
|
||||
union {
|
||||
/* ADDR_INTERNAL_SOCKNAME */
|
||||
/* ADDR_INTERNAL_WIREADDR */
|
||||
struct wireaddr wireaddr;
|
||||
/* ADDR_INTERNAL_ALLPROTO */
|
||||
u16 port;
|
||||
/* ADDR_INTERNAL_WIREADDR */
|
||||
char sockname[108];
|
||||
/* ADDR_INTERNAL_SOCKNAME */
|
||||
char sockname[sizeof(((struct sockaddr_un *)0)->sun_path)];
|
||||
} u;
|
||||
};
|
||||
bool parse_wireaddr_internal(const char *arg, struct wireaddr_internal *addr, u16 port, bool wildcard_ok, const char **err_msg);
|
||||
|
Loading…
Reference in New Issue
Block a user