Backup utilities for ix-386

Pim Zandbergen pim at cti-software.nl
Wed Oct 25 00:37:34 AEST 1989


jgd at rsiatl.UUCP (John G. De Armond) writes:



>The second thing is that it will properly handle end-of-tape.  In interactive,
>the cpio "handles" end-of-tape (apparently) by keying on the special device
>name given and counting bytes.  The problem arises when you use a DC-300
>tape in a DC-600 drive.  Cpio merrily runs off the end of the tape.

In all Unix System V implementations I know, the device driver
fails to do the last write(2) and sets errno to ENXIO (no such
device or address). cpio catches this error and will ask for the
next medium. afio won't, but it was quite easy to fix afio to
recognize ENXIO. This way, you can use afio with any raw device,
without having to know its capacity.

Here's the patch.

*** afio.c.old	Tue Jul  5 21:25:06 1988
--- afio.c	Thu Aug 25 15:03:51 1988
***************
*** 2164,2172 ****
  				    ? syserr()
  				    : "Apparently full");
  				_exit(1);
! 			} else if (got < 0)
! 				fatal(arspec, syserr());
! 			else
  				next(O_WRONLY, "Apparently full");
  		}
  	}
--- 2164,2175 ----
  				    ? syserr()
  				    : "Apparently full");
  				_exit(1);
! 			} else if (got < 0) {
! 				if (errno = ENXIO)
! 					next(O_WRONLY, "End of medium");
! 				else
! 					fatal(arspec, syserr());
! 			} else
  				next(O_WRONLY, "Apparently full");
  		}
  	}
-- 
Pim Zandbergen                                 internet : pim at cti-software.nl
CTI Software BV                                uucp     : ..!uunet!ctisbv!pim
Laan Copes van Cattenburch 70                  phone    : +31 70 542302
2585 GD The Hague, The Netherlands             fax      : +31 70 512837



More information about the Comp.unix.i386 mailing list