Darren Tucker wrote in
<CALDDTe39k4UFJWBvts5HWbbhHO+Vw9OAP0zBhu-Hje-2aR9+xA at mail.gmail.com>:
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)