diff options
author | Peter Lemenkov <lemenkov@gmail.com> | 2010-12-07 12:40:50 +0100 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2010-12-07 12:40:50 +0100 |
commit | d65284ddd23c43d6ae881c88c697d1cd7ffb5a50 (patch) | |
tree | 8ab0220dd51f8e7c3f9d5a04f2491580e77c3c6e | |
parent | 5c93e5c170982fa45945ef229d37e204850a5a64 (diff) |
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>
-rw-r--r-- | bios_extract.c | 9 |
1 files changed, 8 insertions, 1 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", @@ -110,7 +117,7 @@ main(int argc, char *argv[]) int i, len; unsigned char *tmp; - if ((argc != 2) || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ + if ((argc != 2) || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ HelpPrint(argv[0]); return 1; } |