diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2012-07-13 15:07:28 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@vyatta.com> | 2012-07-13 15:07:28 -0700 |
commit | 138bc5da67d51700b32dacdbdb4b86373695f069 (patch) | |
tree | 8993703070bb1f7277869c15ffba034e2926cd67 | |
parent | 8046e1ea6d185c3577f2e9001d3507931cd1d27b (diff) | |
download | vyatta-cfg-138bc5da67d51700b32dacdbdb4b86373695f069.tar.gz vyatta-cfg-138bc5da67d51700b32dacdbdb4b86373695f069.zip |
Optimize commit logging
Bug 8190
Use perl functions rather than going out to shell
-rw-r--r-- | scripts/vyatta-log-commit.pl | 5 |
1 files changed, 3 insertions, 2 deletions
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); |