mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0236-perl-Set-program-name-to-the-true-name-instead-of-pe.patch

ffd6ed
From e673618a8710922593fde2db8fda740a698d82cf Mon Sep 17 00:00:00 2001
ffd6ed
From: "Richard W.M. Jones" <rjones@redhat.com>
ffd6ed
Date: Sun, 13 Sep 2015 13:45:32 +0100
ffd6ed
Subject: [PATCH] perl: Set program name to the true name instead of 'perl'.
ffd6ed
ffd6ed
Currently any Perl program has the handle program name field set
ffd6ed
to 'perl'.  Set it to the true name (derived from $0).
ffd6ed
ffd6ed
(cherry picked from commit e102bcf3cfcbcb2b47ad88334f03d5abf636f1e5)
ffd6ed
---
ffd6ed
 generator/perl.ml | 6 ++++++
ffd6ed
 1 file changed, 6 insertions(+)
ffd6ed
ffd6ed
diff --git a/generator/perl.ml b/generator/perl.ml
ffd6ed
index 29d9ccc..f664594 100644
ffd6ed
--- a/generator/perl.ml
ffd6ed
+++ b/generator/perl.ml
ffd6ed
@@ -753,6 +753,12 @@ sub new {
ffd6ed
   my $g = Sys::Guestfs::_create ($flags);
ffd6ed
   my $self = { _g => $g, _flags => $flags };
ffd6ed
   bless $self, $class;
ffd6ed
+
ffd6ed
+  # If we don't do this, the program name is always set to 'perl'.
ffd6ed
+  my $program = $0;
ffd6ed
+  $program =~ s{.*/}{};
ffd6ed
+  $self->set_program ($program);
ffd6ed
+
ffd6ed
   return $self;
ffd6ed
 }
ffd6ed
 
ffd6ed
-- 
ffd6ed
1.8.3.1
ffd6ed