Index: contrib/tnftp/src/cmds.c =================================================================== --- contrib/tnftp/src/cmds.c (revision 352727) +++ contrib/tnftp/src/cmds.c (working copy) @@ -2653,10 +2653,14 @@ goto usage; } - if (dir & RATE_PUT) + if (dir & RATE_PUT) { sndbuf_size = size; - if (dir & RATE_GET) + set_sndbufsize = 1; + } + if (dir & RATE_GET) { rcvbuf_size = size; + set_rcvbufsize = 1; + } fprintf(ttyout, "Socket buffer sizes: send %d, receive %d.\n", sndbuf_size, rcvbuf_size); code = 0; Index: contrib/tnftp/src/ftp_var.h =================================================================== --- contrib/tnftp/src/ftp_var.h (revision 352727) +++ contrib/tnftp/src/ftp_var.h (working copy) @@ -296,7 +296,9 @@ GLOBAL int options; /* used during socket creation */ +GLOBAL int set_sndbufsize; /* set socket send buffer size if true*/ GLOBAL int sndbuf_size; /* socket send buffer size */ +GLOBAL int set_rcvbufsize; /* set socket receive buffer size if true*/ GLOBAL int rcvbuf_size; /* socket receive buffer size */ GLOBAL int macnum; /* number of defined macros */ Index: contrib/tnftp/src/util.c =================================================================== --- contrib/tnftp/src/util.c (revision 352727) +++ contrib/tnftp/src/util.c (working copy) @@ -1087,11 +1087,11 @@ sndbuf_size); } - if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, + if (set_sndbufsize && setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (void *)&sndbuf_size, sizeof(sndbuf_size)) == -1) warn("Unable to set sndbuf size %d", sndbuf_size); - if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, + if (set_rcvbufsize && setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void *)&rcvbuf_size, sizeof(rcvbuf_size)) == -1) warn("Unable to set rcvbuf size %d", rcvbuf_size); }