1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

See ChangeLog: Sat Jun 26 12:15:59 CEST 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-06-26 10:23:06 +00:00
parent 1423b4239b
commit 080c9ca49f
39 changed files with 2651 additions and 1912 deletions

View file

@ -92,16 +92,22 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
if( control == IOBUFCTRL_UNDERFLOW ) {
assert( size ); /* need a buffer */
clearerr( fp );
nbytes = fread( buf, 1, size, fp );
if( feof(fp) && !nbytes )
rc = -1; /* okay: we can return EOF now. */
else if( ferror(fp) && errno != EPIPE ) {
log_error("%s: read error: %s\n",
a->fname, strerror(errno));
rc = G10ERR_READ_FILE;
if ( feof(fp)) { /* On terminals you could easiely read as many EOFs as you call */
rc = -1; /* fread() or fgetc() repeatly. Every call will block until you press */
*ret_len = 0; /* CTRL-D. So we catch this case before we call fread() again. */
}
else {
clearerr( fp );
nbytes = fread( buf, 1, size, fp );
if( feof(fp) && !nbytes )
rc = -1; /* okay: we can return EOF now. */
else if( ferror(fp) && errno != EPIPE ) {
log_error("%s: read error: %s\n",
a->fname, strerror(errno));
rc = G10ERR_READ_FILE;
}
*ret_len = nbytes;
}
*ret_len = nbytes;
}
else if( control == IOBUFCTRL_FLUSH ) {
if( size ) {