c_client: Fix parallel-make issue creating 'man' directory
authorColin Walters <walters@verbum.org>
Mon, 13 Aug 2012 19:32:31 +0000 (15:32 -0400)
committerJulien Danjou <julien@danjou.info>
Tue, 14 Aug 2012 11:33:01 +0000 (13:33 +0200)
With make -j, it was possible to hit a race condition in the code to
make the 'man' directory.

Signed-off-by: Julien Danjou <julien@danjou.info>
src/c_client.py

index d006d30..31ed3b5 100644 (file)
@@ -5,6 +5,7 @@ from functools import reduce
 import getopt
 import os
 import sys
+import errno
 import time
 import re
 
@@ -2902,8 +2903,11 @@ Refer to the README file in xcb/proto for more info.
     raise
 
 # Ensure the man subdirectory exists
-if not os.path.exists('man'):
+try:
     os.mkdir('man')
+except OSError, e:
+    if e.errno != errno.EEXIST:
+        raise
 
 today = time.strftime('%Y-%m-%d', time.gmtime(os.path.getmtime(args[0])))