Blame bios_extract-0002-Fixed-issue-with-modules-filenames-containing-slash.patch

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