diff --git a/syncmail b/syncmail index 789d4136..03297357 100755 --- a/syncmail +++ b/syncmail @@ -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 '''\