🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Steven M. Schultz Sun, 05 May 1991 08:04
dd exit status bug (+fix)
#94
Author: Steven M. Schultz
Date: Sun, 05 May 1991 08:04
95 lines
2080 bytes
File: /usr/src/bin/dd.c

Description:
	When dd(1) is writing an archive to tape, and
	encounters a write error or even an end of tape
	mark, it returns exit status 0, which spoils error
	checking in scripts and especially if it is the last
	command in a list.

Repeat-By:
	try it; or inspect code to see that term() always
	exits with zero.

Fix:
	Apply the following patch and recompile 'dd'.

*** dd.c.old	Sun Feb  8 14:24:49 1987
--- dd.c	Sun Mar 31 00:23:49 1991
***************
*** 313,319 ****
  			perror("read");
  			if((cflag&NERR) == 0) {
  				flsh();
! 				term();
  			}
  			ibc = 0;
  			for(c=0; c<ibs; c++)
--- 313,319 ----
  			perror("read");
  			if((cflag&NERR) == 0) {
  				flsh();
! 				term(1);
  			}
  			ibc = 0;
  			for(c=0; c<ibs; c++)
***************
*** 323,329 ****
  		}
  		if(ibc == 0 && --files<=0) {
  			flsh();
! 			term();
  		}
  		if(ibc != ibs) {
  			nipr++;
--- 323,329 ----
  		}
  		if(ibc == 0 && --files<=0) {
  			flsh();
! 			term(0);
  		}
  		if(ibc != ibs) {
  			nipr++;
***************
*** 365,371 ****
  		c = write(obf, obuf, obc);
  		if(c != obc) {
  			perror("write");
! 			term();
  		}
  		obc = 0;
  	}
--- 365,371 ----
  		c = write(obf, obuf, obc);
  		if(c != obc) {
  			perror("write");
! 			term(1);
  		}
  		obc = 0;
  	}
***************
*** 592,602 ****
  		null(c);
  }
  
! term()
  {
  
  	stats();
! 	exit(0);
  }
  
  stats()
--- 592,603 ----
  		null(c);
  }
  
! term(status)
! int status;
  {
  
  	stats();
! 	exit(status);
  }
  
  stats()
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads