If a file to send in ASCII mode already has CRLF as end-of-line,

don't add excessive CR on the wire.

PR:		bin/59285
Submitted by:	Andrey Beresovsky <and at rsu.ru>
MFC after:	1 week
This commit is contained in:
Yaroslav Tykhiy 2003-11-15 11:08:26 +00:00
parent 4d450ff944
commit db1c2da334

View File

@ -1970,7 +1970,7 @@ dataconn(char *name, off_t size, char *mode)
static int
send_data(FILE *instr, FILE *outstr, off_t blksize, off_t filesize, int isreg)
{
int c, filefd, netfd;
int c, cp, filefd, netfd;
char *buf;
off_t cnt;
@ -1978,16 +1978,18 @@ send_data(FILE *instr, FILE *outstr, off_t blksize, off_t filesize, int isreg)
switch (type) {
case TYPE_A:
cp = '\0';
while ((c = getc(instr)) != EOF) {
if (recvurg)
goto got_oob;
byte_count++;
if (c == '\n') {
if (c == '\n' && cp != '\r') {
if (ferror(outstr))
goto data_err;
(void) putc('\r', outstr);
}
(void) putc(c, outstr);
cp = c;
}
if (recvurg)
goto got_oob;