File LPRng-3.8.28-warn.diff of Package lprng
--- src/common/getqueue.c
+++ src/common/getqueue.c
@@ -1687,7 +1687,10 @@
}
lseek( tempfd, 0, SEEK_SET );
lseek( status, 0, SEEK_SET );
- ftruncate( status, 0 );
+ if (ftruncate( status, 0 ) < 0) {
+ Errorcode = JABORT;
+ LOGERR_DIE(LOG_ERR) "Trim_status_file: cannot truncate tempfile" );
+ }
while( (count = ok_read( tempfd, buffer, sizeof(buffer) ) ) > 0 ){
if( write( status, buffer, count) < 0 ){
Errorcode = JABORT;
--- src/common/lpd_control.c
+++ src/common/lpd_control.c
@@ -428,12 +428,16 @@
int fd = -1;
if( (file = Queue_status_file_DYN) &&
(fd = Checkwrite( file, &statb,O_RDWR,0,0)) > 0 ){
- ftruncate( fd, 0);
+ if (ftruncate( fd, 0) < 0) {
+ LOGERR_DIE(LOG_ERR) ("Do_queue_control: ftruncate of fd '%d' failed"), fd);
+ }
close(fd);
}
if( (file = Status_file_DYN) &&
(fd = Checkwrite( file, &statb,O_RDWR,0,0)) > 0 ){
- ftruncate( fd, 0);
+ if (ftruncate( fd, 0) < 0) {
+ LOGERR_DIE(LOG_ERR) ("Do_queue_control: ftruncate of fd '%d' failed"), fd);
+ }
close(fd);
}
}
@@ -551,7 +555,7 @@
SNPRINTF( line, sizeof(line)) "%s\n", Printer_DYN );
DEBUGF(DCTRL3)("Do_queue_control: sending '%s' to LPD", line );
if( Write_fd_str( Lpd_request, line ) < 0 ){
- LOGERR_DIE(LOG_ERR) _("Do_queue_control: write to fd '%d' failed"),
+ LOGERR_DIE(LOG_ERR) ("Do_queue_control: write to fd '%d' failed"),
Lpd_request );
}
}