1
0
Fork 0

Adding upstream version 1.16~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-21 11:20:42 +01:00
parent dcb6186936
commit dd83f83a63
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
33 changed files with 939 additions and 1280 deletions

View file

@ -3,7 +3,7 @@
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -56,18 +56,18 @@ void Pretty_print::operator()( const char * const msg, FILE * const f ) const
*/
long readblock( const int fd, uint8_t * const buf, const long size )
{
long pos = 0;
long sz = 0;
errno = 0;
while( pos < size )
while( sz < size )
{
const int sz = std::min( 65536L, size - pos );
const int n = read( fd, buf + pos, sz );
if( n > 0 ) pos += n;
const int psz = std::min( 65536L, size - sz );
const int n = read( fd, buf + sz, psz );
if( n > 0 ) sz += n;
else if( n == 0 ) break; // EOF
else if( errno != EINTR ) break;
errno = 0;
}
return pos;
return sz;
}
@ -76,16 +76,16 @@ long readblock( const int fd, uint8_t * const buf, const long size )
*/
int writeblock( const int fd, const uint8_t * const buf, const int size )
{
int pos = 0;
int sz = 0;
errno = 0;
while( pos < size )
while( sz < size )
{
const int n = write( fd, buf + pos, size - pos );
if( n > 0 ) pos += n;
const int n = write( fd, buf + sz, size - sz );
if( n > 0 ) sz += n;
else if( n < 0 && errno != EINTR ) break;
errno = 0;
}
return pos;
return sz;
}