r113: GCC4 warning fixes
authoryoe <yoe>
Tue, 25 Oct 2005 11:12:20 +0000 (11:12 +0000)
committeryoe <yoe>
Tue, 25 Oct 2005 11:12:20 +0000 (11:12 +0000)
cliserv.h
nbd-client.c
nbd-server.c

index 612fa2b..569d1ce 100644 (file)
--- a/cliserv.h
+++ b/cliserv.h
@@ -75,17 +75,16 @@ void err(const char *s)
 {
        const int maxlen = 150;
        char s1[maxlen], *s2;
-       int n = 0;
 
        strncpy(s1, s, maxlen);
-       if (s2 = strstr(s, "%m")) {
+       if ((s2 = strstr(s, "%m"))) {
                strcpy(s1 + (s2 - s), strerror(errno));
                s2 += 2;
                strcpy(s1 + strlen(s1), s2);
        }
 #ifndef        sun
        /* Solaris doesn't have %h in syslog */
-       else if (s2 = strstr(s, "%h")) {
+       else if ((s2 = strstr(s, "%h"))) {
                strcpy(s1 + (s2 - s), hstrerror(h_errno));
                s2 += 2;
                strcpy(s1 + strlen(s1), s2);
index 285e27a..8330906 100644 (file)
@@ -63,7 +63,7 @@ int opennet(char *name, int port)
 
 int main(int argc, char *argv[])
 {
-       int port, sock, nbd, one = 1;
+       int port, sock, nbd;
        u64 magic, size64;
        unsigned long size;
        char buf[256] = "\0\0\0\0\0\0\0\0\0";
index fda0c9e..9fb9517 100644 (file)
@@ -354,7 +354,6 @@ SERVER* cmdline(int argc, char *argv[]) {
 void sigchld_handler(int s) {
         int* status=NULL;
        int* i;
-       char buf[80];
        pid_t pid;
 
        while((pid=wait(status)) > 0) {
@@ -393,7 +392,6 @@ void killchild(gpointer key, gpointer value, gpointer user_data) {
  * is severely wrong).
  **/
 void sigterm_handler(int s) {
-       int i;
        int parent=0;
 
        g_hash_table_foreach(children, killchild, &parent);
@@ -724,6 +722,7 @@ int mainloop(CLIENT *client) {
                writeit(client->net, buf, len + sizeof(struct nbd_reply));
                DEBUG("OK!\n");
        }
+       return 0;
 }
 
 /**
@@ -782,7 +781,6 @@ int splitexport(CLIENT* client) {
  * @param net A network socket connected to an nbd client
  **/
 void serveconnection(CLIENT *client) {
-       char buf[80];
        splitexport(client);
 
        if (!client->server->expected_size) {
@@ -879,7 +877,6 @@ void setup_serve(SERVER* serve) {
        struct sockaddr_in addrin;
        struct sigaction sa;
        int addrinlen = sizeof(addrin);
-       int newpid, i;
 #ifndef sun
        int yes=1;
 #else
@@ -927,7 +924,7 @@ void setup_serve(SERVER* serve) {
  **/
 int serveloop(SERVER* serve) {
        struct sockaddr_in addrin;
-       int addrinlen=sizeof(addrin);
+       socklen_t addrinlen=sizeof(addrin);
        for(;;) {
                CLIENT *client;
                int net;