]> granicus.if.org Git - php/commitdiff
Fix race condition in shtool's mkdir -p implementation (bug #51076)
authorRaphael Geissert <geissert@php.net>
Thu, 18 Feb 2010 00:30:12 +0000 (00:30 +0000)
committerRaphael Geissert <geissert@php.net>
Thu, 18 Feb 2010 00:30:12 +0000 (00:30 +0000)
build/shtool

index 8d95db5b608950744cece5579cff1bf821712c0d..e291c5f76ec74e51432617ae8ba6d289fd44ce84 100755 (executable)
@@ -991,7 +991,11 @@ mkdir )
                     if [ ".$opt_t" = .yes ]; then
                         echo "mkdir $pathcomp" 1>&2
                     fi
-                    mkdir $pathcomp || errstatus=$?
+                    mkdir $pathcomp || {
+                        _errstatus=$?
+                        [ -d "$pathcomp" ] || errstatus=${_errstatus}
+                        unset _errstatus
+                    }
                     if [ ".$opt_o" != . ]; then
                         if [ ".$opt_t" = .yes ]; then
                             echo "chown $opt_o $pathcomp" 1>&2