Re: fseek/fgetc puzzle

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Darren Tucker wrote in
 <CALDDTe39k4UFJWBvts5HWbbhHO+Vw9OAP0zBhu-Hje-2aR9+xA@xxxxxxxxxxxxxx>:

Jörg Schilling convinced me in 2017

    Readd removed fflush()/fseek() in between read and write..

    The behave:record_a_resend-2 test failed on Solaris 5.10 and 5.11,
    messages in *record* where separated by four \n / U+000A instead
    of two.  It turns out that the effective sequence

       if((fo = Zopen(name, "a+")) == NULL){
          if((fo = Zopen(name, "wx")) == NULL){

        ...

          if(fseek(fo, -2L, SEEK_END) == 0){
             switch(fread(buf, sizeof *buf, 2, fo)){

        ...
             if(emptyline){
                putc('\n', fo);
                fflush(fo);
             }

    on a O_APPEND|O_RDWR file requires an intermediate

      fseek(fout, 0, SEEK_END))
    or
      fflush()

    which i consider a bug in Solaris stdio.
    Jörg Schilling however convinced me that the standard requires
    this behaviour, and it is also in the C FAQ.  Nonetheless...

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev




[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux