From 6932c3e423c430b169e8bb62d9d5ba2ae66d85fd Mon Sep 17 00:00:00 2001 From: pauget Date: Sat, 14 Feb 2004 20:12:47 +0100 Subject: [PATCH] Nouvelle tentative pour darcs-hash:20040214191247-41617-871f45f0c616ea9ac2fcc736e898bcf0c52cbfea.gz --- syncmail | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/syncmail b/syncmail index c3ff1e74..b15c11f2 100755 --- a/syncmail +++ b/syncmail @@ -232,13 +232,15 @@ def blast_mail(subject, people, filestodiff, contextlines, fromhost): conn.connect(MAILHOST, MAILPORT) user = pwd.getpwuid(os.getuid())[0] - if user=="root" : - # Obtention du real user => signature automatique des commits - for proc in os.popen("ps a -o user,command,tty | grep $(ps h -o tty %s)" % os.getpid() ).readlines() : - userp=string.split(proc,' ')[0] - if userp=="root" : break - else : user=userp - + # Obtention du real user => signature automatique des commits + ppid=os.getpid() + 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 + + userp='pauget' domain = fromhost or getfqdn() #Modif cosmétique pour afficher un sujet explicite : host = string.split(domain,'.')