mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Switch all calls to open() to explicitly open for read
This commit is contained in:
@@ -7,7 +7,7 @@ sub list_services
|
||||
local(@rv, $l);
|
||||
$l = 0;
|
||||
system("$config{'get_services_command'}") if ($config{'get_services_command'});
|
||||
open(SERVICES, $config{services_file});
|
||||
open(SERVICES, "<".$config{services_file});
|
||||
while(<SERVICES>) {
|
||||
chop; s/#.*$//g;
|
||||
if (/^(\S+)\s+([0-9]+)\/(\S+)\s*(.*)$/) {
|
||||
@@ -47,7 +47,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
|
||||
sub modify_service
|
||||
{
|
||||
local(@serv);
|
||||
open(SERVICES, $config{services_file});
|
||||
open(SERVICES, "<".$config{services_file});
|
||||
@serv = <SERVICES>;
|
||||
close(SERVICES);
|
||||
$serv[$_[0]] = "$_[1]\t$_[2]/$_[3]".($_[4] ? "\t$_[4]\n" : "\n");
|
||||
@@ -61,7 +61,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
|
||||
sub delete_service
|
||||
{
|
||||
local(@serv);
|
||||
open(SERVICES, $config{services_file});
|
||||
open(SERVICES, "<".$config{services_file});
|
||||
@serv = <SERVICES>;
|
||||
close(SERVICES);
|
||||
splice(@serv, $_[0], 1);
|
||||
@@ -76,7 +76,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
|
||||
sub list_protocols
|
||||
{
|
||||
local(@rv);
|
||||
open(PROT, $config{protocols_file});
|
||||
open(PROT, "<".$config{protocols_file});
|
||||
while(<PROT>) {
|
||||
chop; s/#.*$//g;
|
||||
if (!/\S/) { next; }
|
||||
@@ -111,7 +111,7 @@ closedir(DIR);
|
||||
# parse each file
|
||||
foreach $f (@files) {
|
||||
$l = 0;
|
||||
open(INET, $f);
|
||||
open(INET, "<".$f);
|
||||
while(<INET>) {
|
||||
chop;
|
||||
if (/^(#+|#<off>#)?\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\??\/\S+|internal)\s*(.*)$/) {
|
||||
@@ -144,7 +144,7 @@ sub create_inet
|
||||
sub modify_inet
|
||||
{
|
||||
local(@inet);
|
||||
open(INET, $_[9]);
|
||||
open(INET, "<".$_[9]);
|
||||
@inet = <INET>;
|
||||
close(INET);
|
||||
$inet[$_[0]] = ($_[1] ? "" : "#")."$_[2]\t$_[3]\t$_[4]\t$_[5]\t$_[6]\t$_[7]".
|
||||
@@ -160,7 +160,7 @@ $inet[$_[0]] = ($_[1] ? "" : "#")."$_[2]\t$_[3]\t$_[4]\t$_[5]\t$_[6]\t$_[7]".
|
||||
sub delete_inet
|
||||
{
|
||||
local(@inet);
|
||||
open(INET, $_[1]);
|
||||
open(INET, "<".$_[1]);
|
||||
@inet = <INET>;
|
||||
close(INET);
|
||||
splice(@inet, $_[0], 1);
|
||||
|
||||
@@ -34,7 +34,7 @@ sub list_rpcs
|
||||
{
|
||||
local(@rv, $l);
|
||||
$l = 0;
|
||||
open(RPC, $config{rpc_file});
|
||||
open(RPC, "<".$config{rpc_file});
|
||||
while(<RPC>) {
|
||||
chop; s/#.*$//g;
|
||||
if (/^(\S+)\s+(\d+)\s*(.*)$/) {
|
||||
@@ -61,7 +61,7 @@ sub create_rpc
|
||||
sub modify_rpc
|
||||
{
|
||||
local(@rpcs);
|
||||
open(RPC, $config{rpc_file});
|
||||
open(RPC, "<".$config{rpc_file});
|
||||
@rpcs = <RPC>;
|
||||
close(RPC);
|
||||
$rpcs[$_[0]] = "$_[1]\t$_[2]".($_[3] ? "\t$_[3]\n" : "\n");
|
||||
@@ -76,7 +76,7 @@ $rpcs[$_[0]] = "$_[1]\t$_[2]".($_[3] ? "\t$_[3]\n" : "\n");
|
||||
sub delete_rpc
|
||||
{
|
||||
local(@rpcs);
|
||||
open(RPC, $config{rpc_file});
|
||||
open(RPC, "<".$config{rpc_file});
|
||||
@rpcs = <RPC>;
|
||||
close(RPC);
|
||||
splice(@rpcs, $_[0], 1);
|
||||
|
||||
@@ -6,7 +6,7 @@ sub list_services
|
||||
local(@rv, $l);
|
||||
$l = 0;
|
||||
system("$config{'get_services_command'}") if ($config{'get_services_command'});
|
||||
open(SERVICES, $config{services_file});
|
||||
open(SERVICES, "<".$config{services_file});
|
||||
while(<SERVICES>) {
|
||||
chop; s/#.*$//g;
|
||||
if (/^(\S+)\s+([0-9]+)\/(\S+)\s*(.*)$/) {
|
||||
@@ -53,7 +53,7 @@ sub modify_service
|
||||
local(@serv, $p);
|
||||
$p = $_[3];
|
||||
$p =~ s/6.*$//;
|
||||
open(SERVICES, $config{services_file});
|
||||
open(SERVICES, "<".$config{services_file});
|
||||
@serv = <SERVICES>;
|
||||
close(SERVICES);
|
||||
$serv[$_[0]] = "$_[1]\t$_[2]/$p".($_[4] ? "\t$_[4]\n" : "\n");
|
||||
@@ -67,7 +67,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
|
||||
sub delete_service
|
||||
{
|
||||
local(@serv);
|
||||
open(SERVICES, $config{services_file});
|
||||
open(SERVICES, "<".$config{services_file});
|
||||
@serv = <SERVICES>;
|
||||
close(SERVICES);
|
||||
splice(@serv, $_[0], 1);
|
||||
@@ -82,7 +82,7 @@ system("$config{'put_services_command'}") if ($config{'put_services_command'});
|
||||
sub list_protocols
|
||||
{
|
||||
local(@rv);
|
||||
open(PROT, $config{protocols_file});
|
||||
open(PROT, "<".$config{protocols_file});
|
||||
while(<PROT>) {
|
||||
chop; s/#.*$//g;
|
||||
if (!/\S/) { next; }
|
||||
|
||||
Reference in New Issue
Block a user