File: 070_map_cb_c.diff

package info (click to toggle)
predict 2.2.3-4
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,712 kB
  • ctags: 1,623
  • sloc: ansic: 19,433; sh: 3,518; makefile: 429; yacc: 318; perl: 82
file content (43 lines) | stat: -rw-r--r-- 1,299 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Index: predict-2.2.3/clients/map/map_cb.c
===================================================================
--- predict-2.2.3.orig/clients/map/map_cb.c	2009-11-14 09:48:53.000000000 -0500
+++ predict-2.2.3/clients/map/map_cb.c	2009-11-14 09:51:07.000000000 -0500
@@ -18,9 +18,11 @@
 *****************************************************************************/
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <netdb.h>
 #include <signal.h>
 #include <time.h>
@@ -39,7 +41,7 @@
 	/* This function implements the arccosine function,
 	   returning a value between 0 and two pi. */
 
-	double result, fraction;
+	double result=0.0, fraction;
 
 	fraction=x/y;
 
@@ -76,7 +78,7 @@
 	bzero((char *)&sin,sizeof(struct sockaddr_in));
 	sin.sin_family = AF_INET;
 	
-	if (pse=getservbyname(service,protocol))
+	if ((pse=getservbyname(service,protocol)))
 		sin.sin_port=pse->s_port;
 
 	else if ((sin.sin_port=htons((unsigned short)atoi(service)))==0)
@@ -85,7 +87,7 @@
 	   return -1;
 	}
 
-	if (phe=gethostbyname(host))
+	if ((phe=gethostbyname(host)))
 		bcopy(phe->h_addr,(char *)&sin.sin_addr,phe->h_length);
 
 	else if ((sin.sin_addr.s_addr = inet_addr(host))==INADDR_NONE)