This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/23992] New: fflush() return -1 whith EBADF errno when pass a closed file descriptor after merge commit bcdaad21


https://sourceware.org/bugzilla/show_bug.cgi?id=23992

            Bug ID: 23992
           Summary: fflush() return -1 whith EBADF errno when pass a
                    closed file descriptor after merge commit bcdaad21
           Product: glibc
           Version: 2.28
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: wangfangpeng1 at huawei dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Hi
    I got the wrong ret value add errno, when call fflush() with a closed file
descriptor arg, after the mainlne merge commit bcdaad21(malloc: tcache double
free check).

This is my testcase:
#include<stdio.h>
#include<errno.h>
#include<unistd.h>
int main(int argc, char const *argv[])
{
        FILE *f;

        f = fopen("testfile", "w");
        fclose(f);

        f = fopen("testfile", "r");
        fclose(f);
        errno = 0;

        int ret = fflush(f);
        if(ret != 0) {
                printf("err! ret=%d errno=%d\n", ret, errno);
                return 1;
        }
        unlink("testfile");
        printf("test ok.\n");
        return 0;
}

Looking forward to your early reply…

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]