aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2009-03-31 07:07:44 +0100
committerMichael Brown <mcb30@etherboot.org>2009-03-31 07:07:44 +0100
commitbbd274a1d65947ae28607b94bb2eebbfa6b8e811 (patch)
treea55d88f27487e68a967206e987ce4bf7a0e9a70d
parente3b9e3d04b8391ef39df40f190ef8b9d689c9f13 (diff)
downloadipxe-bbd274a1d65947ae28607b94bb2eebbfa6b8e811.zip
ipxe-bbd274a1d65947ae28607b94bb2eebbfa6b8e811.tar.gz
ipxe-bbd274a1d65947ae28607b94bb2eebbfa6b8e811.tar.bz2
[efi] Use POSIX version of basename() in elf2efi.c
This is required in order to build on Mac OS X. Suggested-by: Joshua Oreman <oremanj@rwcr.net>
-rw-r--r--src/util/elf2efi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index 886777d..bb766bd 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -29,6 +29,7 @@
#include <bfd.h>
#include <gpxe/efi/efi.h>
#include <gpxe/efi/IndustryStandard/PeImage.h>
+#include <libgen.h>
#define eprintf(...) fprintf ( stderr, __VA_ARGS__ )
@@ -658,6 +659,7 @@ static void write_pe_file ( struct pe_header *pe_header,
*/
static void elf2pe ( const char *elf_name, const char *pe_name,
struct options *opts ) {
+ char pe_name_tmp[ strlen ( pe_name ) + 1 ];
bfd *bfd;
asymbol **symtab;
asection *section;
@@ -669,6 +671,9 @@ static void elf2pe ( const char *elf_name, const char *pe_name,
struct pe_header pe_header;
FILE *pe;
+ /* Create a modifiable copy of the PE name */
+ memcpy ( pe_name_tmp, pe_name, sizeof ( pe_name_tmp ) );
+
/* Open the file */
bfd = open_input_bfd ( elf_name );
symtab = read_symtab ( bfd );
@@ -703,7 +708,7 @@ static void elf2pe ( const char *elf_name, const char *pe_name,
/* Create the .reloc section */
*(next_pe_section) = create_debug_section ( &pe_header,
- basename ( pe_name ) );
+ basename ( pe_name_tmp ) );
next_pe_section = &(*next_pe_section)->next;
/* Write out PE file */