Commit 2781bdaf authored by Niels Möller's avatar Niels Möller
Browse files

(sftp_packet_size): New function.

(sftp_read_packet): Call clearerr after checking for error and
eof.

Rev: src/sftp/buffer.c:1.10
Rev: src/sftp/buffer.h:1.7
parent 92654638
...@@ -212,7 +212,12 @@ sftp_read_packet(struct sftp_input *i) ...@@ -212,7 +212,12 @@ sftp_read_packet(struct sftp_input *i)
switch (done) switch (done)
{ {
case 0: case 0:
return feof(i->f) ? -1 : 0; {
int err = feof(i->f) ? -1 : 0;
clearerr( i->f );
return err;
}
case 4: case 4:
i->left = READ_UINT32(buf); i->left = READ_UINT32(buf);
return 1; return 1;
...@@ -603,3 +608,9 @@ sftp_put_attrib(struct sftp_output *o, const struct sftp_attrib *a) ...@@ -603,3 +608,9 @@ sftp_put_attrib(struct sftp_output *o, const struct sftp_attrib *a)
sftp_put_uint32(o, a->mtime); sftp_put_uint32(o, a->mtime);
} }
} }
int
sftp_packet_size(struct sftp_output* out)
{
return out->i;
}
...@@ -197,5 +197,8 @@ sftp_make_input(FILE *f); ...@@ -197,5 +197,8 @@ sftp_make_input(FILE *f);
struct sftp_output * struct sftp_output *
sftp_make_output(FILE *f); sftp_make_output(FILE *f);
int
sftp_packet_size(struct sftp_output* out);
#endif /* SFTP_BUFFER_H_INCLUDED */ #endif /* SFTP_BUFFER_H_INCLUDED */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment