mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
zdtm: Don't fail in __construct_root if entries exist
Otherwise we might get | OSError: [Errno 17] File exists: '/tmp/criu-root-f8klhI/bin' | os.symlink(".." + ldir, self.root + "/usr" + ldir) | OSError: [Errno 17] File exists | File "zdtm.py", line 209, in __mknod | os.mknod(name, stat.S_IFCHR, rdev) | OSError: [Errno 17] File exists Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
a77d172d1e
commit
b44d39ba5d
@@ -214,15 +214,18 @@ class ns_flavor:
|
||||
rdev = os.stat(name).st_rdev
|
||||
|
||||
name = self.root + name
|
||||
if not os.access(name, os.F_OK):
|
||||
os.mknod(name, stat.S_IFCHR, rdev)
|
||||
os.chmod(name, 0666)
|
||||
|
||||
def __construct_root(self):
|
||||
for dir in self.__root_dirs:
|
||||
if not os.access(self.root + dir, os.F_OK):
|
||||
os.mkdir(self.root + dir)
|
||||
os.chmod(self.root + dir, 0777)
|
||||
|
||||
for ldir in ["/bin", "/sbin", "/lib", "/lib64"]:
|
||||
if not os.access(self.root + "/usr" + ldir, os.F_OK):
|
||||
os.symlink(".." + ldir, self.root + "/usr" + ldir)
|
||||
|
||||
self.__mknod("tty", os.makedev(5, 0))
|
||||
|
Reference in New Issue
Block a user