ObjFW  Diff

Differences From Artifact [af3b7cdc64]:

To Artifact [d5f21c75e8]:


10
11
12
13
14
15
16


17
18
19
20
21
22
23
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"



#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <errno.h>

#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
62
63
64
65
66
67
68


69
70
71







72
73
74
75
76
77
78
	sat->sat_node = node;
	nr = (__typeof__(nr))(void *)sat->sat_zero;
	nr->nr_phase = phase;
	nr->nr_firstnet = OFToBigEndian16(rangeStart);
	nr->nr_lastnet = OFToBigEndian16(rangeEnd);

	if ((sock = socket(AF_APPLETALK, SOCK_DGRAM, 0)) < 0) {


		[OFStdErr writeFormat: @"%@: Failed to create socket: %@\n",
				       [OFApplication programName],
				       OFStrError(OFSocketErrNo())];







		[OFApplication terminateWithStatus: 1];
	}

	if (ioctl(sock, SIOCSIFADDR, &request) != 0) {
		[OFStdErr writeFormat: @"%@: Failed to set address: %@\n",
				       [OFApplication programName],
				       OFStrError(OFSocketErrNo())];







>
>


|
>
>
>
>
>
>
>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	sat->sat_node = node;
	nr = (__typeof__(nr))(void *)sat->sat_zero;
	nr->nr_phase = phase;
	nr->nr_firstnet = OFToBigEndian16(rangeStart);
	nr->nr_lastnet = OFToBigEndian16(rangeEnd);

	if ((sock = socket(AF_APPLETALK, SOCK_DGRAM, 0)) < 0) {
		int errNo = OFSocketErrNo();

		[OFStdErr writeFormat: @"%@: Failed to create socket: %@\n",
				       [OFApplication programName],
				       OFStrError(errNo)];

#ifdef OF_LINUX
		if (errNo == EAFNOSUPPORT)
			[OFStdErr writeLine: @"Did you forget to run "
					     @"\"modprobe appletalk\"?"];
#endif

		[OFApplication terminateWithStatus: 1];
	}

	if (ioctl(sock, SIOCSIFADDR, &request) != 0) {
		[OFStdErr writeFormat: @"%@: Failed to set address: %@\n",
				       [OFApplication programName],
				       OFStrError(OFSocketErrNo())];