Skip to content

fstat doesn't work on pipes #16414

@hoodmane

Description

@hoodmane

Consider the following simple program:

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

int fd[2];

int main(){
    struct stat statbuf;
    pipe(fd);
    int status = fstat(fd[0], &statbuf);
    printf("status: %d\n", status);
	return status;
}

If I compile it with gcc and run it, it will print status: 0. If I compile it with emcc and run it with node, it will print status: -1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions