View Issue Details

IDProjectCategoryView StatusLast Update
0017897CentOS-8glibcpublic2020-12-08 15:21
ReporterHarrix 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version8.2.2004 
Target VersionFixed in Version 
Summary0017897: fgets don't read new entry file
DescriptionOne text log file ( log.txt ). one program add line and the second one read the same file.
With Centos 6 or 7 no problem but with Centos 8 the read program don't detect that a new line have been added.
Steps To Reproducestart mywrite program and in a second terminal start myread
in comment compilation instruction

// MYREAD

#include <stdio.h>
#include <string.h>
#include <unistd.h>
/*
****---------------------------------------------------------------------------
gcc -Wall -o myread.o -c myread.c
gcc -o myread myread.o
****---------------------------------------------------------------------------
*/
#define LOGREC 132

int main( int argc, char** argv )
{
    char logbuf[LOGREC+1];
    FILE *lfp;

    lfp = fopen("./log.txt","r");
    if( lfp )
    {
            do{
                while(fgets(logbuf,LOGREC,lfp))
                {
                    fprintf(stderr,"\nRead(%s)",logbuf);
                }
                sleep(1);
            }while(1);

       fclose(lfp);
    }

return(0);
}

==========================

#include <stdio.h>
#include <string.h>
#include <unistd.h>
/*
****---------------------------------------------------------------------------
gcc -Wall -o mywrite.o -c mywrite.c
gcc -o mywrite mywrite.o
****---------------------------------------------------------------------------
*/

int main( int argc, char** argv )
{
    FILE *lfp;
    int cpt=0;

    lfp = fopen("./log.txt","a");
    if( lfp )
    {

            do{
                 fprintf(lfp,"\n(%3d) - Add line for test into log.txt",cpt++);
                 fflush(lfp);

                 fprintf(stdout,"\n(%3d) - Add line for test into log.txt",cpt);

                 fflush(lfp);
                sleep(1);
            }while(1);
    }

return(0);

=======================================
Tags8.2.2004, compiller, glibc

Activities

Harrix

Harrix

2020-12-08 15:21

reporter  

mywrite.c (702 bytes)
myread.c (646 bytes)

Issue History

Date Modified Username Field Change
2020-11-29 18:04 Harrix New Issue
2020-11-29 18:04 Harrix Tag Attached: 8.2.2004
2020-11-29 18:04 Harrix Tag Attached: compiller
2020-11-29 18:04 Harrix Tag Attached: glibc
2020-12-08 15:21 Harrix File Added: mywrite.c
2020-12-08 15:21 Harrix File Added: myread.c