Apply another patch from Kaori, about return value from write/fwrite. Thanks

This commit is contained in:
Mathieu Malaterre 2011-12-23 08:30:36 +00:00
parent f26b96dd5c
commit b82b6cbd05
4 changed files with 16 additions and 5 deletions

View File

@ -7,6 +7,7 @@ What's New for OpenJPIP
December 22, 2011
* [kaori] fixed auxtrans_manager to enable MAC
* [kaori] warnings due to disregarding return value are removed
November 30, 2011
+ [kaori] TCP return (http-tcp) implemented

View File

@ -65,7 +65,8 @@ void save_codestream( Byte_t *codestream, Byte8_t streamlen, char *fmt)
sprintf( filename, "%4d%02d%02d%02d%02d%02d.%.3s", t_st->tm_year+1900, t_st->tm_mon+1, t_st->tm_mday, t_st->tm_hour, t_st->tm_min, t_st->tm_sec, fmt);
fp = fopen( filename, "wb");
fwrite( codestream, streamlen, 1, fp);
if( fwrite( codestream, streamlen, 1, fp) != 1)
fprintf( stderr, "Error: failed to write codestream to file %s\n", filename);
fclose( fp);
}

View File

@ -484,7 +484,10 @@ void add_vbas_with_bytelen_stream( Byte8_t code, int bytelength, int tmpfd)
seg = ( code >> (n*7)) & 0x7f;
if( n)
seg |= 0x80;
write( tmpfd, ( Byte4_t *)&seg, 1);
if( write( tmpfd, ( Byte4_t *)&seg, 1) != 1){
fprintf( FCGI_stderr, "Error: failed to write vbas\n");
return;
}
n--;
}
}
@ -532,7 +535,10 @@ void add_bigendian_bytestream( Byte8_t code, int bytelength, int tmpfd)
n = bytelength - 1;
while( n >= 0) {
seg = ( code >> (n*8)) & 0xff;
write( tmpfd, ( Byte4_t *)&seg, 1);
if( write( tmpfd, ( Byte4_t *)&seg, 1) != 1){
fprintf( FCGI_stderr, "ERROR: failed to write bigendian_bytestream\n");
return;
}
n--;
}
}

View File

@ -147,7 +147,9 @@ void send_responsedata( server_record_t *rec, QR_t *qr)
return;
}
fwrite( jpipstream, len_of_jpipstream, 1, FCGI_stdout);
if( fwrite( jpipstream, len_of_jpipstream, 1, FCGI_stdout) != 1)
fprintf( FCGI_stderr, "Error: failed to write jpipstream\n");
free( jpipstream);
return;
}
@ -160,7 +162,8 @@ void add_EORmsg( int fd, QR_t *qr)
EOR[0] = 0x00;
EOR[1] = is_allsent( *(qr->channel->cachemodel)) ? 0x01 : 0x02;
EOR[2] = 0x00;
write( fd, EOR, 3);
if( write( fd, EOR, 3) != 3)
fprintf( FCGI_stderr, "Error: failed to write EOR message\n");
}
}