Sourceware Bugzilla – Attachment 2064 Details for
Bug 5227
O_ATOMICLOOKUP vs O_CLOEXEC problems with RHEL4 and RHEL5 kernels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
a new test for opendir
opendir-tst2.c (text/plain), 1.48 KB, created by
John Salmon
on 2007-10-29 03:26:24 UTC
(
hide
)
Description:
a new test for opendir
Filename:
MIME Type:
Creator:
John Salmon
Created:
2007-10-29 03:26:24 UTC
Size:
1.48 KB
patch
obsolete
>#include <dirent.h> >#include <errno.h> >#include <fcntl.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> > >/* Name of the directory. */ >char tmpname[] = "dirXXXXXX"; > >/* Do the real work. */ >static int >real_test (void) >{ > DIR *dirp; > char dne[sizeof(tmpname)+sizeof("/doesnotexist")]; > DIR *dnedirp; > > dirp = opendir (tmpname); > > if (dirp == NULL) > { > perror("opendir"); > return 1; > } > > /* Look for a subdirectory that doesn't exist. */ > sprintf(dne, "%s/doesnotexist", tmpname); > dnedirp = opendir (dne); > if (dnedirp != NULL) > { > fputs ("`opendir' succeeded on a non-existant directory\n", stdout); > closedir (dnedirp); > return 1; > } > > if (errno != ENOENT) > { > fprintf(stdout, "`opendir' return error `%s' instead of `%s'\n", > strerror(errno), strerror(ENOENT)); > return 1; > } > > if (closedir(dirp) != 0) > { > perror("closedir"); > return 1; > } > > return 0; >} > > >static int >do_test (int argc, char *argv[]) >{ > int retval; > > if (mktemp (tmpname) == NULL) > { > perror ("mktemp"); > return 1; > } > > /* Create a directory. */ > if (mkdir (tmpname, 0700) < 0) > { > perror ("mkdir"); > /* Should this be an error??? */ > return 0; > } > > retval = real_test (); > > remove (tmpname); > > return retval; >} > > >static void >do_cleanup (void) >{ > remove (tmpname); >} >#define CLEANUP_HANDLER do_cleanup () > > >/* Include the test skeleton. */ >#include <test-skeleton.c>
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 5227
: 2064