diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2012-08-12 12:19:33 +0200 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2012-08-12 12:19:33 +0200 |
commit | 2d52d8c3c647cbfe0ca0c04b87bc7298d5cca14d (patch) | |
tree | 8085ae70facdd6ebad1c2f7862a4636b1a55f449 /src/fiasco.c | |
parent | 1ba42ce46f266fd3090a0e6c145f1b2bea580941 (diff) | |
download | 0xFFFF-2d52d8c3c647cbfe0ca0c04b87bc7298d5cca14d.tar.bz2 |
fiasco: Respect simulate flag
Diffstat (limited to 'src/fiasco.c')
-rw-r--r-- | src/fiasco.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/fiasco.c b/src/fiasco.c index 38accb2..fb6a81b 100644 --- a/src/fiasco.c +++ b/src/fiasco.c @@ -532,10 +532,12 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) { printf(" Output file: %s\n", name); - fd = open(name, O_RDWR|O_CREAT|O_TRUNC, 0644); - if ( fd < 0 ) { - ERROR_INFO("Cannot create output file %s", name); - return -1; + if ( ! simulate ) { + fd = open(name, O_RDWR|O_CREAT|O_TRUNC, 0644); + if ( fd < 0 ) { + ERROR_INFO("Cannot create output file %s", name); + return -1; + } } free(name); @@ -552,10 +554,12 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) { if ( image->layout ) { - fd = open(layout_name, O_RDWR|O_CREAT|O_TRUNC, 0644); - if ( fd < 0 ) { - ERROR_INFO("Cannot create layout file %s", layout_name); - return -1; + if ( ! simulate ) { + fd = open(layout_name, O_RDWR|O_CREAT|O_TRUNC, 0644); + if ( fd < 0 ) { + ERROR_INFO("Cannot create layout file %s", layout_name); + return -1; + } } free(layout_name); |