nbd/nbd-2.9.5-warn.diff

49 lines
1.6 KiB
Diff

diff -uNrp nbd-2.9.5/nbd-server.c nbd-2.9.5.nowarn/nbd-server.c
--- nbd-2.9.5/nbd-server.c 2007-07-30 16:48:09.400856000 +0200
+++ nbd-2.9.5.nowarn/nbd-server.c 2007-07-30 17:00:30.179327000 +0200
@@ -395,7 +395,7 @@ SERVER* cmdline(int argc, char *argv[])
size_t last;
char suffix;
gboolean do_output=FALSE;
- gchar* section_header;
+ gchar* section_header=NULL;
if(argc==1) {
return NULL;
@@ -865,7 +865,7 @@ ssize_t rawexpwrite(off_t a, char *buf,
* @return 0 on success, nonzero on failure
**/
int rawexpwrite_fully(off_t a, char *buf, size_t len, CLIENT *client) {
- ssize_t ret;
+ ssize_t ret = 0;
while(len > 0 && (ret=rawexpwrite(a, buf, len, client)) > 0 ) {
a += ret;
@@ -907,7 +907,7 @@ ssize_t rawexpread(off_t a, char *buf, s
* @return 0 on success, nonzero on failure
**/
int rawexpread_fully(off_t a, char *buf, size_t len, CLIENT *client) {
- ssize_t ret;
+ ssize_t ret = 0;
while(len > 0 && (ret=rawexpread(a, buf, len, client)) > 0 ) {
a += ret;
@@ -1266,7 +1266,7 @@ void serveconnection(CLIENT *client) {
void set_peername(int net, CLIENT *client) {
struct sockaddr_in addrin;
struct sockaddr_in netaddr;
- size_t addrinlen = sizeof( addrin );
+ socklen_t addrinlen = sizeof( addrin );
char *peername;
char *netname;
char *tmp;
@@ -1486,7 +1486,7 @@ int serveloop(GArray* servers) {
}
/* child */
g_hash_table_destroy(children);
- for(i=0;i<servers->len,serve=(g_array_index(servers, SERVER*, i));i++) {
+ for(i=0; (i<servers->len && (serve=(g_array_index(servers, SERVER*, i)))); i++) {
close(serve->socket);
}
/* FALSE does not free the