Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 641827 Details for
Bug 875175
improper inode reuse if readdir called
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test program
test.c (text/x-csrc), 1.46 KB, created by
Eric Paris
on 2012-11-09 20:36:14 UTC
(
hide
)
Description:
test program
Filename:
MIME Type:
Creator:
Eric Paris
Created:
2012-11-09 20:36:14 UTC
Size:
1.46 KB
patch
obsolete
>#include <dirent.h> >#include <getopt.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> > >#include <sys/stat.h> >#include <sys/types.h> >#include <sys/xattr.h> > >static int do_stat(char *filename) >{ > int rc; > struct stat statbuf; > > rc = stat(filename, &statbuf); > if (rc) > return rc; > > printf("ino=%lu\n", (long unsigned int)statbuf.st_ino); > > return 0; >} > >static int do_broken(char *filename) >{ > struct dirent *dirent; > DIR *cwd; > int rc; > > cwd = opendir("./"); > if (!cwd) > return 1; > dirent = readdir(cwd); > dirent = dirent; //compiler warning that i wasn't using dirent > > rc = do_stat(filename); > if (rc) > return rc; > > closedir(cwd); > > return 0; >} > >static int do_correct(char *filename) >{ > return do_stat(filename); >} > >int main(int argc, char *argv[]) >{ > int c; > char *filename; > int broken = 1; > int correct = 0; > > while (1) { > int option_index = 0; > static struct option long_options[] = { > {"broken", no_argument, 0, 'b' }, > {"correct", no_argument, 0, 'c' }, > {0, 0, 0, 0 } > }; > > c = getopt_long(argc, argv, "bc", long_options, &option_index); > if (c == -1) > break; > switch (c) { > case 'b': > broken = 1; > correct = 0; > break; > case 'c': > broken = 0; > correct = 1; > break; > default: > printf("usage: %s [-b|-c] filename\n", argv[0]); > return 0; > }; > } > if (optind != (argc-1)) { > printf("must pass filename"); > return 1; > } > filename = argv[optind]; > > if (broken) > do_broken(filename); > else if (correct) > do_correct(filename); > > 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 875175
:
641716
| 641827