Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 120674 Details for
Bug 178298
Building libperl on an hfsplus filesystem gives screwy disappearing-reappearing makefiles
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
checkdir.c
checkdir.c (text/plain), 1.96 KB, created by
Duane Griffin
on 2007-05-30 02:11:29 UTC
(
hide
)
Description:
checkdir.c
Filename:
MIME Type:
Creator:
Duane Griffin
Created:
2007-05-30 02:11:29 UTC
Size:
1.96 KB
patch
obsolete
>#include <errno.h> >#include <fcntl.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> >#include <linux/types.h> >#include <linux/dirent.h> >#include <linux/limits.h> >#include <linux/unistd.h> >#include <sys/types.h> >#include <sys/stat.h> > >_syscall3(int, getdents, uint, fd, struct dirent *, dirp, uint, count) > >const char *filename = "Makefile"; > >#define DE_BUF_SIZE 2000 > >void checkdir(const char *name) >{ > int fd; > char buffer[DE_BUF_SIZE]; > struct stat file_info; > long unsigned total = 0; > char path[PATH_MAX]; > > snprintf(path, PATH_MAX, "%s/%s", name, filename); > if (!lstat(path, &file_info)) { > fprintf(stdout, "file info '%s':\n%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\n", > path, > file_info.st_dev, > file_info.st_ino, > file_info.st_mode, > file_info.st_nlink, > file_info.st_uid, > file_info.st_gid, > file_info.st_rdev, > file_info.st_size, > file_info.st_blksize, > file_info.st_blocks, > file_info.st_atime, > file_info.st_mtime, > file_info.st_ctime); > } > > fd = open(name, O_RDONLY); > if (fd == -1) { > fprintf(stderr, "could not open directory '%s': %s\n", name, strerror(errno)); > return; > } > > while (1) { > int offset = 0; > struct dirent *entry; > int count = getdents(fd, (struct dirent *) buffer, DE_BUF_SIZE); > if (count == 0) { > break; > } else if (count == -1) { > fprintf(stderr, "could not read directory entry: %s\n", strerror(errno)); > break; > } > > while (offset < count) { > entry = (struct dirent *) (buffer + offset); > if (strcmp(filename, entry->d_name)) { > ++total; > } else { > fprintf(stdout, "%s\t%lu\n", name, total); > goto out; > } > > offset += entry->d_reclen; > } > } > >out: > if (close(fd)) { > fprintf(stderr, "could not close directory '%s': %s\n", name, strerror(errno)); > } >} > >int main(int argc, char *argv[]) >{ > if (argc == 1) { > fprintf(stderr, "Usage: %s <dir> [<dir>...]\n", argv[0]); > exit(1); > } > > for (++argv; *argv; ++argv) { > checkdir(*argv); > } > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 178298
: 120674