UID, pwd.getpwnam() ile alınır; GID ise grp.getgrnam() ile.
This commit is contained in:
@@ -15,6 +15,7 @@ import os
|
||||
import glob
|
||||
import shutil
|
||||
import pwd
|
||||
import grp
|
||||
|
||||
import gettext
|
||||
__trans = gettext.translation('pisi', fallback=True)
|
||||
@@ -69,7 +70,7 @@ def chown(sourceFile, uid = "root", gid = "root"):
|
||||
'''change the owner and group id of sourceFile to uid and gid'''
|
||||
if can_access_file(sourceFile):
|
||||
try:
|
||||
os.chown(sourceFile, pwd.getpwnam(uid)[2], pwd.getpwnam(gid)[3])
|
||||
os.chown(sourceFile, pwd.getpwnam(uid)[2], grp.getgrnam(gid)[2])
|
||||
except OSError:
|
||||
ctx.ui.error(_(' ActionsAPI [chown]: Operation not permitted: %s (uid: %s, gid: %s)') \
|
||||
% (sourceFile, uid, gid))
|
||||
|
||||
Reference in New Issue
Block a user