This is the mail archive of the mailing list for the binutils 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]

[PATCH] gold: use open_descriptor in binary_unittest

gold's binary_unittest fails on a system where O_BINARY is meaningful.
Rather than just copy the knowledge of O_BINARY setting into the test code,
I made it use open_descriptor like everything else does.

Ok for trunk and 2.23?


2012-12-07  Roland McGrath  <>

	* testsuite/ (Sized_binary_test):
	Use open_descriptor rather than ::open.

--- a/gold/testsuite/
+++ b/gold/testsuite/
@@ -1,6 +1,6 @@
 // -- test Binary_to_elf

-// Copyright 2008 Free Software Foundation, Inc.
+// Copyright 2008, 2012 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <>.

 // This file is part of gold.
@@ -33,6 +33,7 @@
 #include "options.h"
 #include "binary.h"
 #include "object.h"
+#include "descriptors.h"

 #include "test.h"
 #include "testfile.h"
@@ -53,7 +54,7 @@ Sized_binary_test()
   // Use the executable itself as the binary data.
   struct stat st;
   CHECK(::stat(gold::program_name, &st) == 0);
-  int o = ::open(gold::program_name, O_RDONLY);
+  int o = open_descriptor(-1, gold::program_name, O_RDONLY);
   CHECK(o >= 0);
   unsigned char* filedata = new unsigned char[st.st_size];
   CHECK(::read(o, filedata, st.st_size) == st.st_size);

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