ObjFW  Check-in [3067a56f0d]

Overview
Comment:Set sockaddr_un.sun_len if it exists
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3067a56f0d398c2330307f5271c472224de435791152cd52567d7602d46fc4ad
User & Date: js on 2023-07-15 17:18:29
Other Links: manifest | tags
Context
2023-07-15
17:53
Disable UNIX sockets on GNU/Hurd check-in: 0b73f0ff77 user: js tags: trunk
17:18
Set sockaddr_un.sun_len if it exists check-in: 3067a56f0d user: js tags: trunk
16:23
PLATFORMS.md: List C libraries for Linux check-in: cd8ac42607 user: js tags: trunk
Changes

Modified configure.ac from [d991473ff0] to [ee1bc822f7].

1519
1520
1521
1522
1523
1524
1525















1526
1527
1528
1529
1530
1531
1532
		# include <winsock2.h>
		#endif
	])
	AC_CHECK_MEMBER(struct sockaddr_un.sun_path, [
		AC_DEFINE(OF_HAVE_UNIX_SOCKETS, 1,
			[Whether we have UNIX sockets])
		AC_SUBST(USE_SRCS_UNIX_SOCKETS, '${SRCS_UNIX_SOCKETS}')















	], [], [
		#ifdef OF_HAVE_SYS_TYPES_H
		# include <sys/types.h>
		#endif
		#ifdef OF_HAVE_SYS_UN_H
		# include <sys/un.h>
		#endif







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
		# include <winsock2.h>
		#endif
	])
	AC_CHECK_MEMBER(struct sockaddr_un.sun_path, [
		AC_DEFINE(OF_HAVE_UNIX_SOCKETS, 1,
			[Whether we have UNIX sockets])
		AC_SUBST(USE_SRCS_UNIX_SOCKETS, '${SRCS_UNIX_SOCKETS}')

		AC_CHECK_MEMBERS(struct sockaddr_un.sun_len, [], [], [
			#ifdef OF_HAVE_SYS_TYPES_H
			# include <sys/types.h>
			#endif
			#ifdef OF_HAVE_SYS_UN_H
			# include <sys/un.h>
			#endif
			#ifdef _WIN32
			# include <winsock2.h>
			#endif
			#ifdef HAVE_AFUNIX_H
			# include <afunix.h>
			#endif
		])
	], [], [
		#ifdef OF_HAVE_SYS_TYPES_H
		# include <sys/types.h>
		#endif
		#ifdef OF_HAVE_SYS_UN_H
		# include <sys/un.h>
		#endif

Modified src/OFSocket.m from [d7a63b18b9] to [f0f36303c9].

586
587
588
589
590
591
592



593
594
595
596
597
598
599
		@throw [OFOutOfRangeException exception];

	memset(&ret, '\0', sizeof(ret));
	ret.family = OFSocketAddressFamilyUNIX;
	ret.length = (socklen_t)
	    (offsetof(struct sockaddr_un, sun_path) + length);




#ifdef AF_UNIX
	ret.sockaddr.un.sun_family = AF_UNIX;
#else
	ret.sockaddr.un.sun_family = AF_UNSPEC;
#endif
	memcpy(ret.sockaddr.un.sun_path,
	    [path cStringWithEncoding: encoding], length);







>
>
>







586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
		@throw [OFOutOfRangeException exception];

	memset(&ret, '\0', sizeof(ret));
	ret.family = OFSocketAddressFamilyUNIX;
	ret.length = (socklen_t)
	    (offsetof(struct sockaddr_un, sun_path) + length);

#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
	ret.sockaddr.un.sun_len = (uint8_t)length;
#endif
#ifdef AF_UNIX
	ret.sockaddr.un.sun_family = AF_UNIX;
#else
	ret.sockaddr.un.sun_family = AF_UNSPEC;
#endif
	memcpy(ret.sockaddr.un.sun_path,
	    [path cStringWithEncoding: encoding], length);