chiark / gitweb /
bin/chroot-maint (mkdir_p): Create absolute paths correctly.
[distorted-chroot] / bin / chroot-maint
index 5b63037998a537a96ce2af6d36de646bbe59d371..a24d17356f5c628a99b3e8ab5184f6666e1cff7a 100755 (executable)
@@ -618,7 +618,8 @@ def mkdir_p(dir, mode = 0777):
 
   Unlike `OS.makedirs', this doesn't fail if DIR already exists.
   """
-  d = ""
+  if dir.startswith("/"): d = "/"; dir = dir[1:]
+  else: d = ""
   for p in dir.split("/"):
     d = OS.path.join(d, p)
     if d == "": continue