La bonne ?

darcs-hash:20040214193939-41617-d7889dd5e7765142b901c0d20a715d790d1bab8e.gz
This commit is contained in:
pauget 2004-02-14 20:39:39 +01:00
parent 86b10a19ab
commit faf90b89ed

View file

@ -232,22 +232,18 @@ def blast_mail(subject, people, filestodiff, contextlines, fromhost):
conn.connect(MAILHOST, MAILPORT)
user = pwd.getpwuid(os.getuid())[0]
# Obtention du real user => signature automatique des commits
ppid=os.getpid()
print ppid
os.system("ps a -o tty,ppid,pid %s" % ppid)
while user=='root' :
ppid,user = string.split(string.strip(os.popen("ps --no-headers -o ppid,user %s" % ppid).readlines()[0]))
if ppid=='1' :
# C'est init, l'user est donc bien root
break
if user=="root" :
# Obtention du real user => signature automatique des commits
for proc in os.popen("ps --no-headers -o user -t $(ps --no-headers -o tty %s)" % os.getpid() ).readlines() :
userp=string.strip(proc)
if userp=="root" : break
else : user=userp
domain = fromhost or getfqdn()
#Modif cosmétique pour afficher un sujet explicite :
host = string.split(domain,'.')
author = '%s@%s' % (user, domain)
people = 'fred@crans.org'
s = StringIO()
s = StringIO()
sys.stdout = s
try:
print '''\