This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.11-383-gc98d421


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  c98d4212d0d7c9dfc34cf18ea95740370bca5aad (commit)
      from  1cdb2151fbad6bff650e85a0476972881bbc027b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c98d4212d0d7c9dfc34cf18ea95740370bca5aad

commit c98d4212d0d7c9dfc34cf18ea95740370bca5aad
Author: Roland McGrath <roland@redhat.com>
Date:   Mon Apr 19 13:48:00 2010 -0700

    tst-fmemopen: Do not write test file in $srcdir.

diff --git a/ChangeLog b/ChangeLog
index 61700fc..6a01632 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-19  Roland McGrath  <roland@redhat.com>
+
+	* stdio-common/tst-fmemopen.c (TEST_FILE): Macro removed.
+	(main): Take arguments.  Construct test file name from ARGV[0].
+
 2010-04-15  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* string/test-strncmp.c (check_result): New function.
diff --git a/stdio-common/tst-fmemopen.c b/stdio-common/tst-fmemopen.c
index 3c06c45..8aa047e 100644
--- a/stdio-common/tst-fmemopen.c
+++ b/stdio-common/tst-fmemopen.c
@@ -8,11 +8,10 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#define TEST_FILE "test-1"
-
 int
-main (void)
+main (int argc, char **argv)
 {
+  const char *test_file;
   const char blah[] = "BLAH";
   FILE *fp;
   char *mmap_data;
@@ -20,8 +19,14 @@ main (void)
   struct stat fs;
   const char *cp;
 
+  /* Construct the test file name based on ARGV[0], which will be
+     an absolute file name in the build directory.  Don't touch the
+     source directory, which might be read-only.  */
+  if (argc != 1 || asprintf (&test_file, "%s.test", argv[0]) < 0)
+    exit (99);
+
   /* setup the physical file, and use it */
-  if ((fp = fopen (TEST_FILE, "w+")) == NULL)
+  if ((fp = fopen (test_file, "w+")) == NULL)
     exit (1);
   if (fwrite (blah, 1, strlen (blah), fp) != strlen (blah))
     exit (2);
@@ -56,7 +61,7 @@ main (void)
   fclose (fp);
 
   /* Now, mmap the file into a buffer, and do that too */
-  if ((fd = open (TEST_FILE, O_RDONLY)) == -1)
+  if ((fd = open (test_file, O_RDONLY)) == -1)
     exit (3);
   if (fstat (fd, &fs) == -1)
     exit (4);
@@ -105,7 +110,8 @@ main (void)
 
   munmap (mmap_data, fs.st_size);
 
-  unlink (TEST_FILE);
+  unlink (test_file);
+  free (test_file);
 
   return 0;
 }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |    5 +++++
 stdio-common/tst-fmemopen.c |   18 ++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]