[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fstatat(AT_EMPTY_PATH) fails for pipes

From: Tavian Barnes
Subject: fstatat(AT_EMPTY_PATH) fails for pipes
Date: Mon, 6 Dec 2021 09:00:05 -0500

I noticed this bug in the most recent Debian Hurd build of
https://github.com/tavianator/bfs.  Here's a simple reproducer:

$ cat foo.c
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>

int main() {
 struct stat sb;
 int ret = fstatat(STDOUT_FILENO, "", &sb, AT_EMPTY_PATH);
 int err = errno;
 printf("ret = %d, err = %d\n", ret, err);
 return 0;
$ gcc foo.c -o foo
$ ./foo
ret = 0, err = 0
$ ./foo | cat
ret = -1, err = 1073741869

On the other hand, fstat(STDOUT_FILENO, &sb) works fine.

Tavian Barnes

reply via email to

[Prev in Thread] Current Thread [Next in Thread]