##// END OF EJS Templates
posix: do not use fstat in isowner...
Martin Geisler -
r8657:3fa92c61 default
parent child Browse files
Show More
@@ -139,13 +139,8 b' def explain_exit(code):'
139 return _("stopped by signal %d") % val, val
139 return _("stopped by signal %d") % val, val
140 raise ValueError(_("invalid exit code"))
140 raise ValueError(_("invalid exit code"))
141
141
142 def isowner(fp, st=None):
142 def isowner(st):
143 """Return True if the file object f belongs to the current user.
143 """Return True if the stat object st is from the current user."""
144
145 The return value of a util.fstat(f) may be passed as the st argument.
146 """
147 if st is None:
148 st = fstat(fp)
149 return st.st_uid == os.getuid()
144 return st.st_uid == os.getuid()
150
145
151 def find_exe(command):
146 def find_exe(command):
@@ -40,7 +40,7 b' class ui(object):'
40
40
41 def _is_trusted(self, fp, f):
41 def _is_trusted(self, fp, f):
42 st = util.fstat(fp)
42 st = util.fstat(fp)
43 if util.isowner(fp, st):
43 if util.isowner(st):
44 return True
44 return True
45
45
46 tusers, tgroups = self._trustusers, self._trustgroups
46 tusers, tgroups = self._trustusers, self._trustgroups
@@ -164,7 +164,7 b' def explain_exit(code):'
164
164
165 # if you change this stub into a real check, please try to implement the
165 # if you change this stub into a real check, please try to implement the
166 # username and groupname functions above, too.
166 # username and groupname functions above, too.
167 def isowner(fp, st=None):
167 def isowner(st):
168 return True
168 return True
169
169
170 def find_exe(command):
170 def find_exe(command):
@@ -44,7 +44,7 b" def testui(user='foo', group='bar', tuse"
44 return group
44 return group
45 util.groupname = groupname
45 util.groupname = groupname
46
46
47 def isowner(fp, st=None):
47 def isowner(st):
48 return user == cuser
48 return user == cuser
49 util.isowner = isowner
49 util.isowner = isowner
50
50
General Comments 0
You need to be logged in to leave comments. Login now