Skip to content

Commit dcfb8ee

Browse files
committed
Fix race condition in shtool's mkdir -p implementation (bug #51076)
1 parent bf7de28 commit dcfb8ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

build/shtool

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,11 @@ mkdir )
991991
if [ ".$opt_t" = .yes ]; then
992992
echo "mkdir $pathcomp" 1>&2
993993
fi
994-
mkdir $pathcomp || errstatus=$?
994+
mkdir $pathcomp || {
995+
_errstatus=$?
996+
[ -d "$pathcomp" ] || errstatus=${_errstatus}
997+
unset _errstatus
998+
}
995999
if [ ".$opt_o" != . ]; then
9961000
if [ ".$opt_t" = .yes ]; then
9971001
echo "chown $opt_o $pathcomp" 1>&2

0 commit comments

Comments
 (0)