Add one more patch, correcting sign extension in two places:

> From Wofgang Solfrank (ws@tools.de)
> What I discovered was a problem in ckddasd.c, where there are two lseeks
> with an offset of -(CKDDASD_RECHDR_SIZE).  Now CKDDASD_RECHDR_SIZE is
> defined (in hercules.h) as sizeof(CKDDASD_RECHDR), which happens to be
> an unsigned int.  Since the offset in the lseek (and in the ckd_lseek
> that is used as an interface routine to it) is of type off_t, i.e. 64-bit,
> the unsigned is zero-extended to 64 bits, and thus the sign is lost.
This commit is contained in:
agc 2001-02-22 11:34:58 +00:00
parent 2e69b8686f
commit b6af12f488
2 changed files with 32 additions and 1 deletions

View file

@ -1,7 +1,8 @@
$NetBSD: patch-sum,v 1.3 2001/02/21 09:19:23 agc Exp $
$NetBSD: patch-sum,v 1.4 2001/02/22 11:34:58 agc Exp $
MD5 (patch-aa) = 9ff34670eaeb36afe5749377526a7511
MD5 (patch-ab) = 988467f26ca940d05be7d0255e88777c
MD5 (patch-ac) = 421c7f3a40af82630c6bd3bdebd3c23c
MD5 (patch-ad) = 89b5ae924983465348273dd59ee38435
MD5 (patch-ae) = 34a1f9c2e71ef45de7728e9babbd0a57
MD5 (patch-af) = 75f1f52f32ce95806d56912f19a12ec8

View file

@ -0,0 +1,30 @@
$NetBSD: patch-af,v 1.1 2001/02/22 11:34:59 agc Exp $
> From Wofgang Solfrank (ws@tools.de)
> What I discovered was a problem in ckddasd.c, where there are two lseeks
> with an offset of -(CKDDASD_RECHDR_SIZE). Now CKDDASD_RECHDR_SIZE is
> defined (in hercules.h) as sizeof(CKDDASD_RECHDR), which happens to be
> an unsigned int. Since the offset in the lseek (and in the ckd_lseek
> that is used as an interface routine to it) is of type off_t, i.e. 64-bit,
> the unsigned is zero-extended to 64 bits, and thus the sign is lost.
--- ckddasd.c 2001/02/22 10:54:55 1.1
+++ ckddasd.c 2001/02/22 10:55:26
@@ -1663,7 +1663,7 @@
}
/* Backspace over end of track marker */
- rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
+ rc = ckd_lseek (dev, dev->fd, (int) -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
if (rc == -1)
{
/* Handle seek error condition */
@@ -1813,7 +1813,7 @@
}
/* Backspace over end of track marker */
- rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
+ rc = ckd_lseek (dev, dev->fd, (int) -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
if (rc == -1)
{
/* Handle seek error condition */