Skip to content

zero-length read() should return immediately #975

@ericeil

Description

@ericeil

tested on rs_preview build 14905.

Run the following C++ program:

#include <unistd.h>

int main(void)
{
  int fds[2];
  pipe(fds);

  char buf[0];
  read(fds[0], buf, 0);

  return 0;
}

On "real" Linux, this returns immediately. On Windows, it hangs indefinitely.

Found this by running the .NET Core System.IO.Pipes tests; we have a test case that expects a zero-length read from an empty pipe to return immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions