Skip to content

[Bug] DFS v1 多次对同一个文件打开文件描述符,使用最后的文件描述符读取不到数据 #10393

Open
@liminghui12

Description

@liminghui12

RT-Thread Version

5.2.0 posix

Hardware Type/Architectures

qemu-arm

Develop Toolchain

Other

Describe the bug

问题回溯德莫

int test_dfs()
{
    FILE *fp = fopen("/test1.txt", "wb+");
    FILE *fp1 = fopen("/test1.txt", "rb+");
    if (fp)
    {
        fwrite("hello world", 1, 12, fp);
        printf("close fp %p\n", fp);
        fclose(fp);
    }
    if (fp1)
    {
        printf("close fp1 %p\n", fp1);
        fclose(fp1);
    }
    FILE *fp3 = fopen("/test1.txt", "rb+");
    if (fp3)
    {
        fseek(fp3, 0, SEEK_SET);
        char data[1024];
        memset(data, 0, 1024);
        int n = fread(&data, 1, 1024, fp3);
        printf("close fp3 %p, read:%d,%s\n", fp3, n, data);
        fclose(fp3);
    }
    return 0;
}
MSH_CMD_EXPORT(test_dfs,  "test dfs file system");`

Other additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis PR/issue is a bug in the current code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions