www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/10/21/16:30:51

Sender: richdawe AT bigfoot DOT com
Message-ID: <380EB83B.D9BB7F9@tudor21.net>
Date: Thu, 21 Oct 1999 07:52:43 +0100
From: Richard Dawe <richdawe AT bigfoot DOT com>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.10 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Bug in fsetpos()?
Reply-To: djgpp-workers AT delorie DOT com

Hello.

I was looking at fseek(), fgetpos(), fsetpos() earlier and I noticed that
fsetpos() appears to ignore the return value of fseek(). Is this intended?
If not, there's a patch below to fix it. I also altered the return value
to be -1, to be consistent with fseek(). If this is the intended
behaviour, may I ask why?

Here's the patch:

*** fsetpos.c   Tue Dec 13 10:04:04 1994
--- fsetpos.c.new       Thu Oct 21 07:42:44 1999
***************
*** 7,15 ****
  {
    if (stream && pos)
    {
!     fseek(stream, (long)(*pos), SEEK_SET);
!     return 0;
    }
    errno = EFAULT;
!   return 1;
  }
--- 7,14 ----
  {
    if (stream && pos)
    {
!     return(fseek(stream, (long)(*pos), SEEK_SET));
    }
    errno = EFAULT;
!   return -1;
  }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019