From 138bc5da67d51700b32dacdbdb4b86373695f069 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 13 Jul 2012 15:07:28 -0700 Subject: Optimize commit logging Bug 8190 Use perl functions rather than going out to shell --- scripts/vyatta-log-commit.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-log-commit.pl b/scripts/vyatta-log-commit.pl index b3fe6b2..e7e38b2 100644 --- a/scripts/vyatta-log-commit.pl +++ b/scripts/vyatta-log-commit.pl @@ -35,13 +35,14 @@ use lib '/opt/vyatta/share/perl5/'; use Vyatta::Config; use Sys::Syslog qw(:standard :macros); +use POSIX qw(ttyname); # # main # my $commit_status; -my $cur_tty=`ps -o tty= |head -n1`; -my $cur_user=`id -un`; +my $cur_tty = ttyname(0); +my $cur_user = getlogin() || getpwuid($<) || "unknown"; my $status = $ENV{'COMMIT_STATUS'}; chomp($cur_tty); -- cgit v1.2.3