From 80664137759d70923319b369f53bf3b2151a5995 Mon Sep 17 00:00:00 2001 From: yoe Date: Tue, 25 Oct 2005 11:12:20 +0000 Subject: [PATCH] r113: GCC4 warning fixes --- cliserv.h | 5 ++--- nbd-client.c | 2 +- nbd-server.c | 7 ++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cliserv.h b/cliserv.h index 612fa2b..569d1ce 100644 --- 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); diff --git a/nbd-client.c b/nbd-client.c index 285e27a..8330906 100644 --- a/nbd-client.c +++ b/nbd-client.c @@ -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"; diff --git a/nbd-server.c b/nbd-server.c index fda0c9e..9fb9517 100644 --- a/nbd-server.c +++ b/nbd-server.c @@ -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; -- 1.7.10.4