summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2017-03-17 01:44:51 +0100
committerNicolas Dechesne <nicolas.dechesne@linaro.org>2017-03-17 01:44:51 +0100
commit6b39b47c7e0f7cc1310397ebf733f01dd1fbd0ba (patch)
tree56353900c70fd4b537a03c68f20584cb4fb49311
parent1edb38d1727fe9cc639fabaa83b7252258f73746 (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-xmkgpt8
1 files changed, 4 insertions, 4 deletions
diff --git a/mkgpt b/mkgpt
index d84b98c..885e0a3 100755
--- a/mkgpt
+++ b/mkgpt
@@ -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