[Linux-decnet-commit] CVS: dnprogs/fal open.cc,1.8,1.9 open.h,1.2,1.3
Brought to you by:
chrissie_c,
ph3-der-loewe
|
From: Patrick C. <pa...@us...> - 2001-10-16 14:38:04
|
Update of /cvsroot/linux-decnet/dnprogs/fal
In directory usw-pr-cvs1:/tmp/cvs-serv31877
Modified Files:
open.cc open.h
Log Message:
Don't use fgets for reading records as we can't figure out the real length of
the record just read if it contains NUL characters
Index: open.cc
===================================================================
RCS file: /cvsroot/linux-decnet/dnprogs/fal/open.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** open.cc 2001/09/26 18:52:11 1.8
--- open.cc 2001/10/16 12:24:53 1.9
***************
*** 414,429 ****
else
{
! if (::fgets(buf, bs-1, stream))
{
! // Make sure there's a NUL on the end for strlen to find.
! buf[bs] = '\0';
! buflen = strlen(buf); // Leave the LF on the end.
! }
! else
! {
! DAPLOG((LOG_INFO, "fgets returned nothing\n"));
! send_eof();
! return true;
! }
}
}
--- 414,428 ----
else
{
! // Read up to the next LF or EOF
! int newchar;
! buflen = 0;
! do
{
! newchar = getc(stream);
! if (newchar != EOF)
! {
! buf[buflen++] = (char) newchar;
! }
! } while (newchar != EOF && newchar != '\n' && buflen < conn.get_blocksize());
}
}
Index: open.h
===================================================================
RCS file: /cvsroot/linux-decnet/dnprogs/fal/open.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** open.h 2000/09/16 12:54:30 1.2
--- open.h 2001/10/16 12:24:56 1.3
***************
*** 10,14 ****
virtual ~fal_open();
virtual bool process_message(dap_message *m);
!
protected:
--- 10,14 ----
virtual ~fal_open();
virtual bool process_message(dap_message *m);
!
protected:
***************
*** 24,32 ****
bool create;
unsigned int block_size;
!
dap_attrib_message *attrib_msg;
dap_alloc_message *alloc_msg;
dap_protect_message *protect_msg;
!
bool send_file(int, long);
void print_file();
--- 24,32 ----
bool create;
unsigned int block_size;
!
dap_attrib_message *attrib_msg;
dap_alloc_message *alloc_msg;
dap_protect_message *protect_msg;
!
bool send_file(int, long);
void print_file();
***************
*** 37,40 ****
bool create_file(char *);
void send_eof();
!
};
--- 37,40 ----
bool create_file(char *);
void send_eof();
!
};
|