delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/09/15/03:50:06

X-Authentication-Warning: sirppi.helsinki.fi: peuha owned process doing -bs
Date: Fri, 15 Sep 2000 10:45:02 +0300 (EET DST)
From: Esa A E Peuha <peuha AT cc DOT helsinki DOT fi>
Sender: peuha AT cc DOT helsinki DOT fi
To: djgpp-workers AT delorie DOT com
Subject: Re: Bug 000323
In-Reply-To: <200009141851.UAA02531@father.ludd.luth.se>
Message-ID: <Pine.OSF.4.20.0009150929560.3790-100000@sirppi.helsinki.fi>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 14 Sep 2000, Martin Str|mberg wrote:

> Here's patch (pasted so might not apply cleanly) that fixes bug 000323.
> 
> It's mostly for discussion. Am I overlooking/overdoing something?

I think it would be good to pass the append bit to the fsext mechanism.

Of course, open(filename, O_APPEND) should work like
fopen(filename, "a"), so if you feel like implementing that, it would
be nice; that's not so easy to do, though.

> Index: src/libc/ansi/stdio/fopen.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fopen.c,v
> retrieving revision 1.1
> diff -p -u -r1.1 fopen.c
> --- fopen.c     1995/08/23 07:49:24     1.1
> +++ fopen.c     2000/09/14 18:46:14
> @@ -55,8 +55,8 @@ fopen(const char *file, const char *mode
>    if (fd < 0)
>      return NULL;
> 
> -  if (*mode == 'a')
> -    lseek(fd, 0, SEEK_END);
> +  /*  if (*mode == 'a')
> +    lseek(fd, 0, SEEK_END); */
> 
>    f->_cnt = 0;
>    f->_file = fd;

Why would you want not to have the file pointer at the end of the
file?  But if you pass O_APPEND to open (to let fsext know about the
append bit), it will seek to end anyway, so this really is redundant.

> Index: src/libc/ansi/stdio/freopen.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/freopen.c,v
> retrieving revision 1.3
> diff -p -u -r1.3 freopen.c
> --- freopen.c   1999/06/03 17:27:33     1.3
> +++ freopen.c   2000/09/14 18:46:14
> @@ -49,8 +49,8 @@ freopen(const char *file, const char *mo
>    if (fd < 0)
>      return NULL;
> 
> -  if (*mode == 'a')
> -    lseek(fd, 0, SEEK_END);
> +  /*  if (*mode == 'a')
> +    lseek(fd, 0, SEEK_END);*/
> 
>    f->_cnt = 0;
>    f->_file = fd;

The above comment applies here, too.

-- 
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/

- Raw text -


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