Bug 21232

Summary: "restore -s" broken on 64-bit archs
Product: Base System Reporter: Christian Weisgerber <naddy>
Component: binAssignee: Matt Jacob <mjacob>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Christian Weisgerber 2000-09-12 22:30:00 UTC
"restore -s <number>" fails with
"ioctl MTFSF: Inappropriate ioctl for device".

The relevant ioctl() in restore/tape.c unexpectedly casts the
request argument to int.  This leads to sign extension on the alpha,
resulting in 0xFFFFFFFF80086D01 being passed instead of 0x80086D01
(MTFSF).

How-To-Repeat: 
restore -is 1
Comment 1 mjacob 2000-09-12 22:36:17 UTC
> 
> Index: restore/tape.c
> ===================================================================
> RCS file: /home/ncvs/src/sbin/restore/tape.c,v
> retrieving revision 1.17
> diff -u -r1.17 tape.c
> --- restore/tape.c	2000/07/16 23:22:15	1.17
> +++ restore/tape.c	2000/09/12 20:40:10
> @@ -497,7 +497,7 @@
>  		rmtioctl(MTFSF, dumpnum - 1);
>  	else
>  #endif
> -		if (ioctl(mt, (int)MTIOCTOP, (char *)&tcom) < 0)
> +		if (ioctl(mt, MTIOCTOP, (char *)&tcom) < 0)
>  			fprintf(stderr, "ioctl MTFSF: %s\n", strerror(errno));
>  }
>  

Good sleuthing- looks like this has always been there. Thanks.

-matt
Comment 2 Matt Jacob freebsd_committer freebsd_triage 2000-09-12 22:54:53 UTC
State Changed
From-To: open->closed

Applied patch from submitter. 


Comment 3 Matt Jacob freebsd_committer freebsd_triage 2000-09-12 22:54:53 UTC
Responsible Changed
From-To: freebsd-bugs->mjacob

Because I applied the submitter's patch.