Summary: | statvfs sign-extends lower 32 bits of f_fsid field, loses upper 32 bits | ||
---|---|---|---|
Product: | glibc | Reporter: | Anton Rang <rang> |
Component: | libc | Assignee: | Ulrich Drepper <drepper.fsp> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | glibc-bugs |
Priority: | P2 | Flags: | fweimer:
security-
|
Version: | unspecified | ||
Target Milestone: | --- | ||
Host: | x86_64-unknown-linux-gnu (CentOS 5.4) | Target: | x86_64-unknown-linux-gnu (CentOS 5.4) |
Build: | x86_64-unknown-linux-gnu (CentOS 5.4) | Last reconfirmed: |
Description
Anton Rang
2010-05-19 17:47:18 UTC
A really simple test program, if you happen to have a file system around that delivers these FSIDs.... #include <stdio.h> #include <sys/statfs.h> #include <sys/statvfs.h> #include <fcntl.h> void main(int argc, char *argv[]) { int fd; struct statvfs v; struct statfs suck; if (argc != 2) { printf("need mountpoint\n"); return; } fd = open(argv[1], O_RDONLY); if (fd < 0) perror("open"); if (fstatvfs(fd, &v) < 0) perror("fstatvfs"); printf("%016lx\n", v.f_fsid); if (fstatfs(fd, &suck) < 0) perror("fstatfs"); printf("%016lx\n", suck.f_fsid); } For better correctness, the test program should probably do something like unsigned long id; memcpy(&id, &suck.f_fsid, sizeof(id)); printf("%016lx\n", id); rather than just passing the structure to printf and expecting the right thing to happen, but either shows the correct FSID on x86_64. Fixed in git. |