Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 magnus 1
Description: Fix incorrect use of fprintf()
2
Author: Magnus Holmgren <holmgren@debian.org>
3
 
4
--- a/sockets.c
5
+++ b/sockets.c
6
@@ -50,7 +50,7 @@ ReadExact(int sock, char *buf, int n)
7
        j = read(sock, buf + i, (n - i));
8
        if (j <= 0) {
9
            if (j < 0) {
10
-               fprintf(stderr,programName);
11
+               fprintf(stderr,"%s",programName);
12
                perror(": read");
13
            } else {
14
                if (errorMessageFromReadExact) {
15
@@ -81,7 +81,7 @@ WriteExact(int sock, char *buf, int n)
16
        j = write(sock, buf + i, (n - i));
17
        if (j <= 0) {
18
            if (j < 0) {
19
-               fprintf(stderr,programName);
20
+               fprintf(stderr,"%s",programName);
21
                perror(": write");
22
            } else {
23
                fprintf(stderr,"%s: write failed\n",programName);
24
@@ -126,20 +126,20 @@ ConnectToTcpAddr(unsigned int host, int
25
 
26
   sock = socket(AF_INET, SOCK_STREAM, 0);
27
   if (sock < 0) {
28
-    fprintf(stderr,programName);
29
+    fprintf(stderr,"%s",programName);
30
     perror(": ConnectToTcpAddr: socket");
31
     return -1;
32
   }
33
 
34
   if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
35
-    fprintf(stderr,programName);
36
+    fprintf(stderr,"%s",programName);
37
     perror(": ConnectToTcpAddr: connect");
38
     close(sock);
39
     return -1;
40
   }
41
 
42
   if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) {
43
-    fprintf(stderr,programName);
44
+    fprintf(stderr,"%s",programName);
45
     perror(": ConnectToTcpAddr: setsockopt");
46
     close(sock);
47
     return -1;
48
@@ -167,28 +167,28 @@ ListenAtTcpPort(int port)
49
 
50
     sock = socket(AF_INET, SOCK_STREAM, 0);
51
     if (sock < 0) {
52
-       fprintf(stderr,programName);
53
+       fprintf(stderr,"%s",programName);
54
        perror(": ListenAtTcpPort: socket");
55
        return -1;
56
     }
57
 
58
     if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
59
                   (const char *)&one, sizeof(one)) < 0) {
60
-       fprintf(stderr,programName);
61
+       fprintf(stderr,"%s",programName);
62
        perror(": ListenAtTcpPort: setsockopt");
63
        close(sock);
64
        return -1;
65
     }
66
 
67
     if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
68
-       fprintf(stderr,programName);
69
+       fprintf(stderr,"%s",programName);
70
        perror(": ListenAtTcpPort: bind");
71
        close(sock);
72
        return -1;
73
     }
74
 
75
     if (listen(sock, 5) < 0) {
76
-       fprintf(stderr,programName);
77
+       fprintf(stderr,"%s",programName);
78
        perror(": ListenAtTcpPort: listen");
79
        close(sock);
80
        return -1;
81
@@ -244,14 +244,14 @@ AcceptTcpConnection(int listenSock)
82
 
83
     sock = accept(listenSock, (struct sockaddr *) &addr, &addrlen);
84
     if (sock < 0) {
85
-       fprintf(stderr,programName);
86
+       fprintf(stderr,"%s",programName);
87
        perror(": AcceptTcpConnection: accept");
88
        return -1;
89
     }
90
 
91
     if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
92
                   (char *)&one, sizeof(one)) < 0) {
93
-       fprintf(stderr,programName);
94
+       fprintf(stderr,"%s",programName);
95
        perror(": AcceptTcpConnection: setsockopt");
96
        close(sock);
97
        return -1;