MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //proc/self/root/proc/self/root/scripts.20110531.215904.25158/patch_errno
#!/usr/bin/perl
# cpanel - patch_errno                            Copyright(c) 2010 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

BEGIN { unshift @INC, '/usr/local/cpanel'; }

use Cpanel::SafeFile        ();
use Cpanel::SafeRun::Simple ();
use Cpanel::LoadFile        ();
use Cpanel::Logger          ();

eval 'local $SIG{__DIE__}; use Errno;';

my $module_path = $INC{'Errno.pm'};

my $logger = Cpanel::Logger->new();

my $errno_txt = Cpanel::LoadFile::loadfile($module_path);
if ( $errno_txt !~ /use Config/ ) { exit; }

print "Removing useless Config Dep from Errno.\n";

my $mod_fh = Cpanel::SafeFile::safeopen( \*ER, '+<', $module_path );
if ( !$mod_fh ) {
    die print "Could not edit $module_path \n";
}
my @EN = <ER>;
seek( ER, 0, 0 );
my $inconfig = 0;
foreach (@EN) {
    next if (/^use Config/);
    if ( !$inconfig && /\$Config/ ) {
        $inconfig = 1;
        next;
    }
    elsif ( $inconfig && /\$Config/ ) {
        $inconfig = 0;
        next;
    }
    elsif ($inconfig) {
        next;
    }
    else {
        print ER $_;
    }
}
truncate( ER, tell(ER) );
Cpanel::SafeFile::safeclose( \*ER, $mod_fh );

my $is_ok = Cpanel::SafeRun::Simple::saferun( ( -e '/usr/local/cpanel/scripts/check_errno' ? '/usr/local/cpanel/scripts/check_errno' : '/scripts/check_errno' ) );
chomp($is_ok);
if ( !$is_ok || $is_ok ne 'ok' ) {
    print "Patching Failed, restoring previous Errno!\n";
    my $mod_fh2 = Cpanel::SafeFile::safeopen( \*ER, '>', $module_path );
    if ( !$mod_fh2 ) {
        $logger->die("Could not write to $module_path");
    }
    else {
        print ER $errno_txt;
        Cpanel::SafeFile::safeclose( \*ER, $mod_fh2 );
    }
}
my $is_ok = Cpanel::SafeRun::Simple::saferun( ( -e '/usr/local/cpanel/scripts/check_errno' ? '/usr/local/cpanel/scripts/check_errno' : '/scripts/check_errno' ) );
chomp($is_ok);
if ( !$is_ok || $is_ok ne 'ok' ) {
    system '/scripts/perlinstaller', '--force', 'Errno';
}