Menu

#13 print of used udp port buggy

open
nobody
None
5
2007-10-08
2007-10-08
No

i can't quite figure out why int udp_init( short port) is "short" ?

not to mention what happens when using ports like 62001. if wonder -3535 is printed.

the following patch makes the port an int.

-------------------------
--- a/src/udpproto.c 2007-10-09 00:26:45.000000000 +0300
+++ b/src/udpproto.c 2007-10-09 01:04:47.000000000 +0300
@@ -26,7 +26,7 @@
#define ACTION_SCRAPE 2
#define ACTION_ERROR 3

-int udp_init( short port) {
+int udp_init( int port) {
int udp_socket;
struct sockaddr_in sa;
int err;

--- a/include/udpproto.h 2007-05-23 01:55:12.000000000 +0300
+++ b/include/udpproto.h 2007-10-09 01:06:54.000000000 +0300
@@ -6,7 +6,7 @@
#include "util.h"
#include "context.h"

-int udp_init( short port) ;
+int udp_init( int port) ;
int udp_ready( struct btContext *ctx) ;
int udp_connect( struct btContext *ctx, btDownload *dl);
int udp_announce( struct btContext *ctx, btDownload *dl, char *state);
-------------------------

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.