From 319d5265d21f95599cb6ead2f3683fbd0fe2dac8 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Thu, 4 Feb 2010 16:40:49 +0300
Subject: [PATCH 2/3] Fixed issue with modules filenames, containing slash.
Some modules have names, containing slash character(s), so we cannot
simply write them to disk w/o either replacing slash with something else
(backslash, for example) or until we create necessary directories.
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
bios_extract.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/bios_extract.c b/bios_extract.c
index 6c65532..4f0423d 100644
--- a/bios_extract.c
+++ b/bios_extract.c
@@ -42,8 +42,14 @@ unsigned char *
MMapOutputFile(char *filename, int size)
{
unsigned char* Buffer;
+ char* tmp = NULL;
int fd;
+ /* all slash signs '/' in filenames will be replaced by backslash sign '\' */
+ tmp = filename;
+ while ((tmp = strchr(tmp, '/')) != NULL)
+ tmp[0] = '\\';
+
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (fd < 0) {
fprintf(stderr, "Error: unable to open %s: %s\n\n",
--
1.6.6.1