let ipkg fail when a package file to be installed is not found
[openwrt/staging/wigyori.git] / openwrt / package / atftp / patches / 110-services.patch
1 diff -urN atftp.old/tftp.c atftp.dev/tftp.c
2 --- atftp.old/tftp.c 2004-03-16 00:55:56.000000000 +0100
3 +++ atftp.dev/tftp.c 2006-03-22 10:18:54.000000000 +0100
4 @@ -409,7 +409,7 @@
5 int set_peer(int argc, char **argv)
6 {
7 struct hostent *host; /* for host name lookup */
8 - struct servent *sp; /* server entry for tftp service */
9 + int port = htons(69);
10
11 /* sanity check */
12 if ((argc < 2) || (argc > 3))
13 @@ -418,13 +418,6 @@
14 return ERR;
15 }
16
17 - /* get the server entry */
18 - sp = getservbyname("tftp", "udp");
19 - if (sp == 0) {
20 - fprintf(stderr, "tftp: udp/tftp, unknown service.\n");
21 - return ERR;
22 - }
23 -
24 /* look up the host */
25 host = gethostbyname(argv[1]);
26 /* if valid, update s_inn structure */
27 @@ -437,7 +430,7 @@
28 Strncpy(data.hostname, host->h_name,
29 sizeof(data.hostname));
30 data.hostname[sizeof(data.hostname)-1] = 0;
31 - data.sa_peer.sin_port = sp->s_port;
32 + data.sa_peer.sin_port = port;
33 }
34 else
35 {
36 @@ -448,17 +441,17 @@
37 /* get the server port */
38 if (argc == 3)
39 {
40 - sp->s_port = htons(atoi(argv[2]));
41 - if (sp->s_port < 0)
42 + port = htons(atoi(argv[2]));
43 + if (port < 0)
44 {
45 fprintf(stderr, "%s: bad port number.\n", argv[2]);
46 data.connected = 0;
47 return ERR;
48 }
49 - data.sa_peer.sin_port = sp->s_port;
50 + data.sa_peer.sin_port = port;
51 }
52 /* copy port number to data structure */
53 - data.port = ntohs(sp->s_port);
54 + data.port = ntohs(port);
55
56 data.connected = 1;
57 return OK;
58 diff -urN atftp.old/tftpd.c atftp.dev/tftpd.c
59 --- atftp.old/tftpd.c 2004-02-27 03:05:26.000000000 +0100
60 +++ atftp.dev/tftpd.c 2006-03-22 10:23:20.000000000 +0100
61 @@ -230,14 +230,8 @@
62
63 /* find the port */
64 if (tftpd_port == 0)
65 - {
66 - if ((serv = getservbyname("tftp", "udp")) == NULL)
67 - {
68 - logger(LOG_ERR, "atftpd: udp/tftp, unknown service");
69 - exit(1);
70 - }
71 - tftpd_port = ntohs(serv->s_port);
72 - }
73 + tftpd_port = htons(69);
74 +
75 /* initialise sockaddr_in structure */
76 memset(&sa, 0, sizeof(sa));
77 sa.sin_family = AF_INET;