Fixed ifdefs for a label in ncpfs/sock.c
PATCH 1/1 Fixed ifdefs for a label in ncpfs/sock.c
fs/ncpfs/sock.c +2 -0
@@ -587,7 +587,9 @@ }#endif type = ntohs(server->rcv.buf.type); +#ifdef CONFIG_NCPFS_PACKET_SIGNING cont:; +#endif if (type !=NCP_REPLY ) {if (datalen -8 <=sizeof (server->unexpected_packet.data)) { *(__u16 *)(server->unexpected_packet.data) =htons (type);
Signature · 2 lines
Bob Miller Email: [email protected] Open Source Development Lab Phone: 503.626.2455 Ext. 17
fs/ncpfs/sock.c line 594
Quoted 12 lines · Bob Miller
diff -Nru
a/fs/ncpfs/sock.cb/fs/ncpfs/sock.cfs/ncpfs/sock.c +2
-0@@ -587,7 +587,9 @@ }#endif type = ntohs(server->rcv.buf.type); +#ifdef CONFIG_NCPFS_PACKET_SIGNING cont:; +#endif if (type !=NCP_REPLY ) {if (datalen -8 <=sizeof (server->unexpected_packet.data)) {
Eww, personally I think the fix is worse than the warning.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 16 lines · Dave Jones
fs/ncpfs/sock.c line 594
Quoted 12 lines · Bob Miller
diff -Nru
a/fs/ncpfs/sock.cb/fs/ncpfs/sock.cfs/ncpfs/sock.c +2
-0@@ -587,7 +587,9 @@ }#endif type = ntohs(server->rcv.buf.type); +#ifdef CONFIG_NCPFS_PACKET_SIGNING cont:; +#endif if (type !=NCP_REPLY ) {if (datalen -8 <=sizeof (server->unexpected_packet.data)) {Eww, personally I think the fix is worse than the warning.
Quoted 1 line
Dave
I know. I personally hate #ifdef's and goto's... I spent more than a few minutes trying to find a "trivial" way to clean this up, but this was the best I could do without reorganizing LOTS of code (then it's not "trivial" anymore).
Signature · 2 lines
Bob Miller Email: [email protected] Open Source Development Lab Phone: 503.626.2455 Ext. 17
Quoted 15 lines · Bob Miller
Quoted 14 lines · Dave Jones
Quoted 12 lines · Bob Miller
diff -Nru
a/fs/ncpfs/sock.cb/fs/ncpfs/sock.cfs/ncpfs/sock.c +2
-0@@ -587,7 +587,9 @@ }#endif type = ntohs(server->rcv.buf.type); +#ifdef CONFIG_NCPFS_PACKET_SIGNING cont:; +#endif if (type !=NCP_REPLY ) {if (datalen -8 <=sizeof (server->unexpected_packet.data)) {
Quoted 7 lines
Quoted 3 lines
Eww, personally I think the fix is worse than the warning.
Dave
I know. I personally hate #ifdef's and goto's... I spent more than a few minutes trying to find a "trivial" way to clean this up, but this was the best I could do without reorganizing LOTS of code (then it's not "trivial" anymore).
If you want just eliminate some gotos (and eventually warnings... you should always enable packet signing, btw), try this one ;-) But I'm not sure that code below is better than using goto...
Petr Vandrovec (ncpfs maintainer)
fs/ncpfs/sock.c +12 -16
@@ -584,10 +584,12 @@ server->rcv.len =8 ; server->rcv.state =4 ;break ; - } +case 4 : + datalen = server->rcv.buf.len; + type =ntohs (server->rcv.buf.type2); + } else#endif type =ntohs (server->rcv.buf.type); -cont:;if (type !=NCP_REPLY ) {if (datalen -8 <=sizeof (server->unexpected_packet.data)) { *(__u16 *)(server->unexpected_packet.data) =htons (type);
@@ -622,12 +624,6 @@ server->rcv.len = datalen -10 ; server->rcv.state =1 ;break ; -#ifdef CONFIG_NCPFS_PACKET_SIGNING -case 4 : - datalen = server->rcv.buf.len; - type =ntohs (server->rcv.buf.type2); - goto cont; -#endif case 1 : req = server->rcv.creq;if (req->tx_type !=NCP_ALLOC_SLOT_REQUEST ) {
@@ -652,20 +648,20 @@ }#endif ncp_finish_request(req, req->datalen); - nextreq:; +if (0 ) { +case 3 : +ncp_finish_request (server->rcv.creq, -EIO ); + }__ncp_next_request (server); +if (0 ) { +case 5 : +info_server (server,0 , server->unexpected_packet.data, server->unexpected_packet.len); + }case 2 : - next:; server->rcv.ptr = (unsigned char *)&server->rcv.buf; server->rcv.len =10 ; server->rcv.state =0 ;break ; -case 3 : -ncp_finish_request (server->rcv.creq, -EIO ); - goto nextreq; -case 5 : -info_server (server,0 , server->unexpected_packet.data, server->unexpected_packet.len); - goto next; } } }
Quoted 1 line · Dave Jones
Eww, personally I think the fix is worse than the warning.
Yah that is ugly, but I personally think we should strive to eliminate warnings. One day this really may be an unused label.
I am not sure how else to cleanly get rid of this.
Robert Love