summaryrefslogtreecommitdiff
path: root/bios_extract.c
diff options
context:
space:
mode:
authorPeter Lemenkov <lemenkov@gmail.com>2010-12-07 12:40:50 +0100
committerLuc Verhaegen <libv@skynet.be>2010-12-07 12:40:50 +0100
commitd65284ddd23c43d6ae881c88c697d1cd7ffb5a50 (patch)
tree8ab0220dd51f8e7c3f9d5a04f2491580e77c3c6e /bios_extract.c
parent5c93e5c170982fa45945ef229d37e204850a5a64 (diff)
bios_extract: Fix issue with modules filenames containing slashHEADmaster
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. One example of such BIOS image can be found here: http://peter.fedorapeople.org/LinuxBIOS/ka7_ty.award.slash_in_modules_names.bios Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Diffstat (limited to 'bios_extract.c')
-rw-r--r--bios_extract.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bios_extract.c b/bios_extract.c
index 4075b96..0bd4dd9 100644
--- a/bios_extract.c
+++ b/bios_extract.c
@@ -42,8 +42,15 @@ unsigned char *
MMapOutputFile(char *filename, int size)
{
unsigned char* Buffer;
+ char *tmp;
int fd;
+ /* all slash signs '/' in filenames will be replaced by a
+ 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",