Kaydet (Commit) 47929ae5 authored tarafından Your Name's avatar Your Name

chown root only run as root

üst 0fa588d9
...@@ -516,14 +516,17 @@ class ArchiveTar(ArchiveBase): ...@@ -516,14 +516,17 @@ class ArchiveTar(ArchiveBase):
# Note: This is no good while installing a inary package. # Note: This is no good while installing a inary package.
# Thats why this is optional. # Thats why this is optional.
if os.path.isfile(tarinfo.name): if os.path.isfile(tarinfo.name):
os.chown(tarinfo.name, 0,0) if os.getuid() == 0:
os.chown(tarinfo.name, 0,0)
os.chmod(tarinfo.name, tarinfo.mode) os.chmod(tarinfo.name, tarinfo.mode)
# FIXME: We must chmod directory as 755. Empty directory permission is 777. Remove this # FIXME: We must chmod directory as 755. Empty directory permission is 777. Remove this
elif os.path.isdir(tarinfo.name): elif os.path.isdir(tarinfo.name):
os.chown(tarinfo.name, 0,0) if os.getuid() == 0:
os.chown(tarinfo.name, 0,0)
os.chmod(tarinfo.name, 0o755) os.chmod(tarinfo.name, 0o755)
else: else:
os.lchown(tarinfo.name, 0,0) if os.getuid() == 0:
os.lchown(tarinfo.name, 0,0)
if self.no_same_owner: if self.no_same_owner:
uid = os.getuid() uid = os.getuid()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment