NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/44807: something broken in stat(2)
>Number: 44807
>Category: lib
>Synopsis: something broken in stat(2)
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 30 18:15:00 +0000 2011
>Originator: Jukka Ruohonen
>Release: 5.1 - 5.99.48
>Organization:
-
>Description:
Another one caught by automated tests.
Something related to stat(2) is seriously broken somewhere. For instance,
opening "/dev/bpf" and stat'ing it either fails or reports odd results.
While I haven't done any analysis, it seems that this might be related to
the old, closed, bugs:
PR kern/37550: fstat(1) not reporting open descriptors properly
PR kern/37878: fdclone(9) suspected of not working well with fstat(1)
Given that those were fixed, it seems that this is again a regression.
>How-To-Repeat:
To add more weirdness, the following program prints a value 0 on 5.99.48,
but the fstat(2) fails on 5.1.
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int
main(void)
{
struct stat st;
int fd, rv;
(void)memset(&st, 0, sizeof(struct stat));
fd = open("/dev/bpf", O_RDONLY);
if (fd < 0)
return EXIT_FAILURE;
rv = fstat(fd, &st);
if (rv < 0)
return EXIT_FAILURE;
(void)printf("mode = %u\n", st.st_mode);
(void)close(fd);
return EXIT_SUCCESS;
}
>Fix:
Unknown.
Home |
Main Index |
Thread Index |
Old Index