Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Sep 2001 19:26:55 +0100
From:      Brian Somers <brian@freebsd-services.com>
To:        "Andrey A. Chernov" <ache@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, brian@freebsd-services.com
Subject:   Re: cvs commit: src/lib/libc/stdio stdio.c 
Message-ID:  <200109071826.f87IQtJ20155@hak.lan.Awfulhak.org>
In-Reply-To: Message from "Andrey A. Chernov" <ache@FreeBSD.org>  of "Fri, 07 Sep 2001 10:16:03 PDT." <200109071716.f87HG3a05025@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> ache        2001/09/07 10:16:03 PDT
> 
>   Modified files:
>     lib/libc/stdio       stdio.c 
>   Log:
>   1) If __SAPP stream is not seekable, remove __SAPP flag on first call instead
>   of repeating unsuccessful lseek call on each write (original stdio bug).
>   
>   2) Save errno accross _sseek call in _swrite to not touch it in case write
>   success (original stdio bug).
>   
>   3) Add _sseek error checking back, but only for __SOPT mode now.
>   
>   Revision  Changes    Path
>   1.18      +11 -4     src/lib/libc/stdio/stdio.c

Will the following code work ?

  fd = socket(blah);
  connect(fd, blah);
  dup2(fd, STDIN_FILENO);
  fp = fopen(fd, "a+");
  fputc('x', fp);
  close(STDIN_FILENO);
  open("myfile", O_RDWR|O_APPEND);	/* file contains data */
  fseek(fp, 0, SEEK_SET);
  fputs("hello world\n", fp);

or will it end up not attempting to seek to the end of the file and 
overwriting from offset 0 ?

<disclaimer>I haven't read the diffs yet</disclaimer>

Cheers.

-- 
Brian <brian@freebsd-services.com>                <brian@Awfulhak.org>
      http://www.freebsd-services.com/        <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour !      <brian@[uk.]OpenBSD.org>



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109071826.f87IQtJ20155>