diff options
author | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2017-03-17 01:44:51 +0100 |
---|---|---|
committer | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2017-03-17 01:44:51 +0100 |
commit | 6b39b47c7e0f7cc1310397ebf733f01dd1fbd0ba (patch) | |
tree | 56353900c70fd4b537a03c68f20584cb4fb49311 | |
parent | 1edb38d1727fe9cc639fabaa83b7252258f73746 (diff) |
mkgpt: fix race condition
when running the script with a POSIX shell, "&>" is very different from what it
would do in bash.. And the commands were backgrounded. We have seen races where
the generated gpt_both0.bin file was incorrect.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
-rwxr-xr-x | mkgpt | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -52,10 +52,10 @@ SECONDARY=`mktemp` DATA=`mktemp` echo "=== Extract MBR, Primary and Secondary headers, and partition table" -dd if=$IN of=$MBR bs=512 count=1 &> /dev/null -dd if=$IN of=$PRIMARY bs=512 count=1 skip=1 &> /dev/null -dd if=$IN of=$SECONDARY bs=512 count=1 skip=2 &> /dev/null -dd if=$IN of=$DATA bs=512 count=32 skip=3 &> /dev/null +dd if=$IN of=$MBR bs=512 count=1 > /dev/null 2>&1 +dd if=$IN of=$PRIMARY bs=512 count=1 skip=1 > /dev/null 2>&1 +dd if=$IN of=$SECONDARY bs=512 count=1 skip=2 > /dev/null 2>&1 +dd if=$IN of=$DATA bs=512 count=32 skip=3 > /dev/null 2>&1 echo "=== Create $OUT file" cat $MBR $PRIMARY $DATA $DATA $SECONDARY > $OUT |