Browse Source

scripts/cp-noerror: Avoid a race

Its possible something can delete $1 (since it may be empty) whilst cp-noerror
is starting. Add an exception to handle this issue since if this happens, we
shouldn't return an error.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Richard Purdie 10 years ago
parent
commit
13061ed1e1
1 changed files with 3 additions and 2 deletions
  1. 3 2
      scripts/cp-noerror

+ 3 - 2
scripts/cp-noerror

@@ -2,6 +2,7 @@
 #
 # Allow copying of $1 to $2 but if files in $1 disappear during the copy operation,
 # don't error.
+# Also don't error if $1 disappears.
 #
 
 import sys
@@ -47,5 +48,5 @@ try:
     copytree(sys.argv[1], sys.argv[2])
 except shutil.Error:
    pass
-
-
+except OSError:
+   pass