}
# Use in-memory cache
-if (length(@list_zone_names_cache)) {
+if (scalar(@list_zone_names_cache)) {
return @list_zone_names_cache;
}
# a list of classes, each containing options for the section type.
sub get_config
{
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
@get_config_cache = &get_config_file($cfengine_conf);
}
return \@get_config_cache;
# Parses the cfd.conf file
sub get_cfd_config
{
-if (!length(@get_cfd_config_cache)) {
+if (!scalar(@get_cfd_config_cache)) {
@get_cfd_config_cache = &get_config_file($cfd_conf);
}
return \@get_cfd_config_cache;
sub list_cron_jobs
{
local (@rv, $lnum, $f);
-if (length(@cron_jobs_cache)) {
+if (scalar(@cron_jobs_cache)) {
return @cron_jobs_cache;
}
# Returns a list of dovecot config entries
sub get_config
{
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
@get_config_cache = ( );
local $lnum = 0;
local ($section, @sections);
# Returns a structure containing the details of all disks and partitions
sub list_disks_partitions
{
-if (length(@list_disks_partitions_cache)) {
+if (scalar(@list_disks_partitions_cache)) {
return @list_disks_partitions_cache;
}
}
}
if ($lvm_module) {
- if (!length(@physical_volumes)) {
+ if (!scalar(@physical_volumes)) {
@physical_volumes = ();
foreach $vg (&foreign_call("lvm", "list_volume_groups")) {
push(@physical_volumes,
# Returns an array reference containing the contents of the Frox config file
sub get_config
{
- if (!length(@get_config_cache)) {
+ if (!scalar(@get_config_cache)) {
local $lnum = 0;
open(CONF, $config{'frox_conf'});
while(<CONF>) {
if (&supports_users()) {
# Include user home
@uinfo = getpwnam($remote_user);
- if ($access{'home'} && length(@uinfo)) {
+ if ($access{'home'} && scalar(@uinfo)) {
push(@accessdirs, &resolve_links($uinfo[7]));
}
}
# Returns a list of IPsec secret keys
sub list_secrets
{
-if (!length(@list_secrets_cache)) {
+if (!scalar(@list_secrets_cache)) {
local (@lines);
local $lnum = 0;
open(SEC, $config{'secrets'});
sub get_config
{
local $file = $_[0] || $config{'auth_ldap'};
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
local $lnum = 0;
@get_config_cache = ( );
&open_readfile(CONF, $file);
# Returns an array ref of information from nsswitch.conf
sub get_nsswitch_config
{
-if (!length(@get_nsswitch_cache)) {
+if (!scalar(@get_nsswitch_cache)) {
@get_nsswitch_cache = ( );
local $lnum = 0;
open(CONF, $nsswitch_config_file);
{
local @uinfo;
if ($config{'data_dir'} && $config{'ldap_user'} &&
- length(@uinfo = getpwnam($config{'ldap_user'}))) {
+ scalar(@uinfo = getpwnam($config{'ldap_user'}))) {
opendir(DATADIR, $config{'data_dir'});
local @datafiles = grep { !/^\./ } readdir(DATADIR);
closedir(DATADIR);
# Returns a list of users, in the same format as the useradmin module
sub list_users
{
-if (!length(@list_users_cache)) {
+if (!scalar(@list_users_cache)) {
local $ldap = &ldap_connect();
local $base = &get_user_base();
local $rv = $ldap->search(base => $base,
if ($rv->code) {
&error(&text('usave_eadd', $rv->error));
}
-push(@list_users_cache, $_[0]) if (length(@list_users_cache));
+push(@list_users_cache, $_[0]) if (scalar(@list_users_cache));
$ldap->unbind();
&useradmin::refresh_nscd() if (!$batch_mode);
}
}
$ldap->unbind();
@list_users_cache = grep { $_ ne $_[0] } @list_users_cache
- if (length(@list_users_cache));
+ if (scalar(@list_users_cache));
&useradmin::refresh_nscd() if (!$batch_mode);
}
# Returns a list of groups, in the same format as the useradmin module
sub list_groups
{
-if (!length(@list_groups_cache)) {
+if (!scalar(@list_groups_cache)) {
local $ldap = &ldap_connect();
local $base = &get_group_base();
local $rv = $ldap->search(base => $base,
if ($rv->code) {
&error(&text('gsave_eadd', $rv->error));
}
-push(@list_groups_cache, $_[0]) if (length(@list_groups_cache));
+push(@list_groups_cache, $_[0]) if (scalar(@list_groups_cache));
$ldap->unbind();
&useradmin::refresh_nscd() if (!$batch_mode);
}
}
$ldap->unbind();
@list_groups_cache = grep { $_ ne $_[0] } @list_groups_cache
- if (length(@list_groups_cache));
+ if (scalar(@list_groups_cache));
&useradmin::refresh_nscd() if (!$batch_mode);
}
# Parses lilo.conf and returns a list of directives
sub get_lilo_conf
{
-return @lilo_conf_cache if (length(@lilo_conf_cache));
+return @lilo_conf_cache if (scalar(@lilo_conf_cache));
open(CONF, $config{'lilo_conf'});
local $lnum = -1;
local ($image, $line);
# Returns an array of associative arrays containing printcap fields
sub list_printcap
{
-return @list_printcap_cache if (length(@list_printcap_cache));
+return @list_printcap_cache if (scalar(@list_printcap_cache));
local(@rv, @line, $line, $cont, $lnum, $i, %done, $capfile);
foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
next if (!$capfile || $done{$capfile}++);
# Returns an array of associative arrays containing printcap fields
sub list_printcap
{
-return @list_printcap_cache if (length(@list_printcap_cache));
+return @list_printcap_cache if (scalar(@list_printcap_cache));
local(@rv, @line, @comment, @eline, @sline, $line, $cont, $lnum, $i,
%done, $capfile);
foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
# Returns an array of associative arrays containing printcap fields
sub list_printcap
{
-return @list_printcap_cache if (length(@list_printcap_cache));
+return @list_printcap_cache if (scalar(@list_printcap_cache));
local(@rv, @line, @comment, $line, $cont, $lnum, $i, %done, $capfile);
foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
next if (!$capfile || $done{$capfile}++);
# mail file in home dir, and maildir in home dir
sub get_mail_style
{
-if (!length(@mail_style_cache)) {
+if (!scalar(@mail_style_cache)) {
if ($config{'auto'}) {
# Based on mail server
if ($config{'mail_system'} == 1) {
# Returns a list of /etc/mailcap entries
sub list_mailcap
{
-if (!length(@list_mailcap_cache)) {
+if (!scalar(@list_mailcap_cache)) {
@list_mailcap_cache = ( );
open(CAP, $mailcap_file);
local $lnum = 0;
return ( undef, 0, 1, undef ) if (!@uinfo && !$pamany);
if (@uinfo) {
- if (length(@allowusers)) {
+ if (scalar(@allowusers)) {
# Only allow people on the allow list
return ( undef, 0, 0, undef )
if (!&users_match(\@uinfo, @allowusers));
}
- elsif (length(@denyusers)) {
+ elsif (scalar(@denyusers)) {
# Disallow people on the deny list
return ( undef, 0, 0, undef )
if (&users_match(\@uinfo, @denyusers));
# Redirect if the user has only one module
@msc_modules = &get_visible_module_infos()
- if (!length(@msc_modules));
+ if (!scalar(@msc_modules));
if (!defined($in{'cat'})) {
# Maybe redirect to some module after login
}
@msc_modules = &get_visible_module_infos()
- if (!length(@msc_modules));
+ if (!scalar(@msc_modules));
print "</head>\n";
local $dir = $current_lang_info->{'dir'} ? "dir=\"$current_lang_info->{'dir'}\""
# Redirect if the user has only one module
@msc_modules = &get_visible_module_infos()
- if (!length(@msc_modules));
+ if (!scalar(@msc_modules));
if (@msc_modules == 1 && $gconfig{'gotoone'}) {
&redirect("$msc_modules[0]->{'dir'}/");
exit;
}
@msc_modules = &get_visible_module_infos()
- if (!length(@msc_modules));
+ if (!scalar(@msc_modules));
print '<body bgcolor=#424242 link=#000000 vlink=#000000 text=#000000 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" '.$_[8].'>';
# Redirect if the user has only one module
@msc_modules = &get_available_module_infos()
- if (!length(@msc_modules));
+ if (!scalar(@msc_modules));
if (@msc_modules == 1 && $gconfig{'gotoone'}) {
&redirect("$msc_modules[0]->{'dir'}/");
exit;
}
@msc_modules = &get_available_module_infos()
- if (!length(@msc_modules));
+ if (!scalar(@msc_modules));
print "</head>\n";
if ($theme_no_table) {
# Returns the parsed my.cnf file
sub get_mysql_config
{
-if (!length(@mysql_config_cache)) {
+if (!scalar(@mysql_config_cache)) {
if (!-r $config{'my_cnf'}) {
return undef;
}
# Get all modules visible to this user
@osx_modules = &get_available_module_infos()
- if (!length(@osx_modules));
+ if (!scalar(@osx_modules));
# Show table of categories
local $one = @osx_modules == 1 && $gconfig{'gotoone'};
sub updates_available
{
my ($nocache) = @_;
-if (!length(@updates_available_cache)) {
+if (!scalar(@updates_available_cache)) {
if ($nocache || &cache_expired($updates_cache_file)) {
# Get from original source
@updates_available_cache = &software::update_system_updates();
# 2 and the maildir name for ~/Maildir style
sub postfix_mail_system
{
-if (!length(@mail_system_cache)) {
+if (!scalar(@mail_system_cache)) {
local $home_mailbox = &get_current_value("home_mailbox");
if ($home_mailbox) {
@mail_system_cache = $home_mailbox =~ /^(.*)\/$/ ?
# Returns an array reference of entries from the Postfix master.cf file
sub get_master_config
{
-if (!length(@master_config_cache)) {
+if (!scalar(@master_config_cache)) {
@master_config_cache = ( );
local $lnum = 0;
local $prog;
{
local ($type) = @_;
return 1 if ($type eq 'hash'); # Assume always supported
-if (!length(@supports_map_type_cache)) {
+if (!scalar(@supports_map_type_cache)) {
@supports_map_type = ( );
open(POSTCONF, "$config{'postfix_config_command'} -m |");
while(<POSTCONF>) {
}
print "<tr> <td width=50% valign=top nowrap>\n";
printf "<input type=radio name=readers_def value=1 %s> %s\n",
- length(@readers) ? "" : "checked", $text{'access_readers1'};
+ scalar(@readers) ? "" : "checked", $text{'access_readers1'};
printf "<input type=radio name=readers_def value=0 %s> %s<br>\n",
- length(@readers) ? "checked" : "", $text{'access_readers0'};
+ scalar(@readers) ? "checked" : "", $text{'access_readers0'};
print "<textarea rows=20 cols=30 name=readers>",
join("\n", @readers),"</textarea>",
&user_chooser_button("readers", 1),"</td>\n";
}
print "<td width=50% valign=top nowrap>\n";
printf "<input type=radio name=writers_def value=1 %s> %s\n",
- length(@writers) ? "" : "checked", $text{'access_writers1'};
+ scalar(@writers) ? "" : "checked", $text{'access_writers1'};
printf "<input type=radio name=writers_def value=0 %s> %s<br>\n",
- length(@writers) ? "checked" : "", $text{'access_writers0'};
+ scalar(@writers) ? "checked" : "", $text{'access_writers0'};
print "<textarea rows=20 cols=30 name=writers>",
join("\n", @writers),"</textarea>",
&user_chooser_button("writers", 1),"</td> </tr>\n";
"$text{'routes_title'}<br>(smtproutes)",
"$text{'percents_title'}<br>(percenthack)",
"$text{'assigns_title'}<br>(assign)",
- length(@queue) ?
+ scalar(@queue) ?
"$text{'queue_title'}<br>".&text('queue_count', scalar(@queue)) :
"$text{'queue_title'}<br>(qmail-qread)",
$text{'boxes_title'} );
# Returns a list of all SMTP routes
sub list_routes
{
-if (!length(@list_routes_cache)) {
+if (!scalar(@list_routes_cache)) {
local $lnum = 0;
local @rv;
open(ROUTES, $qmail_routes_file);
# Returns a list of all virtualdomains file entries
sub list_virts
{
-if (!length(@list_virts_cache)) {
+if (!scalar(@list_virts_cache)) {
local $lnum = 0;
local @rv;
open(VIRTS, $qmail_virts_file);
# Returns a list of qmail user assignments
sub list_assigns
{
-if (!length(@list_assigns_cache)) {
+if (!scalar(@list_assigns_cache)) {
local @rv;
local $lnum = 0;
open(ASSIGNS, $qmail_assigns_file);
'&group='.&urlize($group{0,'group'}) : 'none';
}
elsif ($cgi eq 'user_filesys.cgi' || $cgi eq 'copy_user_form.cgi') {
- return length(@uinfo) ?
+ return scalar(@uinfo) ?
'user='.&urlize($remote_user) : 'user=root';
}
elsif ($cgi eq 'group_filesys.cgi' || $cgi eq 'copy_group_form.cgi') {
- if (length(@uinfo)) {
+ if (scalar(@uinfo)) {
my @ginfo = getgrgid($uinfo[3]);
- return 'group='.&urlize($ginfo[0]) if (length(@ginfo));
+ return 'group='.&urlize($ginfo[0]) if (scalar(@ginfo));
}
return 'group=bin';
}
sub get_raidtab
{
local ($raiddev, $device, %mdstat);
-return \@get_raidtab_cache if (length(@get_raidtab_cache));
+return \@get_raidtab_cache if (scalar(@get_raidtab_cache));
%mdstat = &get_mdstat();
if ($raid_mode eq "raidtools") {
&indexof($mounted, @mounted)); }
elsif ($mount) { return ($mount->[0], $mount->[2], 0,
&indexof($mount, @mounts)); }
-if (!length(@physical_volumes)) {
+if (!scalar(@physical_volumes)) {
@physical_volumes = ();
foreach $vg (&lvm::list_volume_groups()) {
push(@physical_volumes,
# Returns a list of user attribute objects
sub list_user_attrs
{
-if (!length(@list_user_attrs_cache)) {
+if (!scalar(@list_user_attrs_cache)) {
@list_user_attrs_cache = ( );
local $lnum = 0;
open(ATTR, $config{'user_attr'});
# Returns a list of all profiles
sub list_prof_attrs
{
-if (!length(@list_prof_attrs_cache)) {
+if (!scalar(@list_prof_attrs_cache)) {
@list_prof_attrs_cache = ( );
local $lnum = 0;
open(ATTR, $config{'prof_attr'});
# Returns a user of all authorizations
sub list_auth_attrs
{
-if (!length(@list_auth_attrs_cache)) {
+if (!scalar(@list_auth_attrs_cache)) {
@list_auth_attrs_cache = ( );
local $lnum = 0;
open(ATTR, $config{'auth_attr'});
# Returns a user of all execorizations
sub list_exec_attrs
{
-if (!length(@list_exec_attrs_cache)) {
+if (!scalar(@list_exec_attrs_cache)) {
@list_exec_attrs_cache = ( );
local $lnum = 0;
open(ATTR, $config{'exec_attr'});
# Returns a list of policy config file directives
sub get_policy_config
{
-if (!length(@policy_conf_cache)) {
+if (!scalar(@policy_conf_cache)) {
@policy_conf_cache = ( );
local $lnum = 0;
open(ATTR, $config{'policy_conf'});
# Returns a list of project objects
sub list_projects
{
-if (!length(@list_projects_cache)) {
+if (!scalar(@list_projects_cache)) {
@list_projects_cache = ( );
local $lnum = 0;
open(ATTR, $config{'project'});
# Returns 1 list of all encryption algorithms, including the internal __unix__
sub list_crypt_algorithms
{
-if (!length(@list_crypt_algorithms_cache)) {
+if (!scalar(@list_crypt_algorithms_cache)) {
push(@list_crypt_algorithms_cache, { 'name' => '__unix__' } );
local $lnum = 0;
open(CRYPT, $config{'crypt_conf'});
# Parses the sarg config file into directives
sub get_config
{
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
local $lnum = 0;
open(CONF, $config{'sarg_conf'});
while(<CONF>) {
# list_access(textfile)
sub list_access
{
-if (!length(@list_access_cache)) {
+if (!scalar(@list_access_cache)) {
@list_access_cache = ( );
local $lnum = 0;
open(ACC, $_[0]);
# list_domains(textfile)
sub list_domains
{
-if (!length(@list_domains_cache)) {
+if (!scalar(@list_domains_cache)) {
@list_domains_cache = ( );
local $lnum = 0;
local $cmt;
# list_generics(textfile)
sub list_generics
{
-if (!length(@list_generics_cache)) {
+if (!scalar(@list_generics_cache)) {
@list_generics_cache = ( );
local $lnum = 0;
local $cmt;
# list_mailers(textfile)
sub list_mailers
{
-if (!length(@list_mailers_cache)) {
+if (!scalar(@list_mailers_cache)) {
local $lnum = 0;
@list_mailers_cache = ( );
local $cmt;
# list_virtusers(textfile)
sub list_virtusers
{
-if (!length(@list_virtusers_cache)) {
+if (!scalar(@list_virtusers_cache)) {
@list_virtusers_cache = ( );
local $lnum = 0;
local $cmt;
&unlock_file($mods);
$basedir = &get_hostsentry_dir();
-if (length(@foreign)) {
+if (scalar(@foreign)) {
&lock_file("$basedir/moduleForeignDomain.allow");
&open_tempfile(FOREIGN, ">$basedir/moduleForeignDomain.allow");
foreach $f (@foreign) {
&close_tempfile(FOREIGN);
&unlock_file("$basedir/moduleForeignDomain.allow");
}
-if (length(@multiple)) {
+if (scalar(@multiple)) {
&lock_file("$basedir/moduleMultipleLogins.allow");
&open_tempfile(MULTIPLE, ">$basedir/moduleMultipleLogins.allow");
foreach $m (@multiple) {
# Check if the user is a member of any of the allowed groups
local %ugroups;
local @uinfo = getpwnam($user);
- return 0 if (!length(@uinfo));
+ return 0 if (!scalar(@uinfo));
local @ginfo = getgrgid($uinfo[3]);
- $ugroups{$ginfo[0]}++ if (length(@ginfo));
+ $ugroups{$ginfo[0]}++ if (scalar(@ginfo));
foreach my $o (&other_groups($user)) {
$ugroups{$o}++;
}
# Returns a list of NUT attribute names and values for some UPS
sub get_ups_values
{
-if (!length(@get_ups_cache)) {
+if (!scalar(@get_ups_cache)) {
local @rv;
open(SENS, "upsc ".quotemeta($_[0])." |");
while(<SENS>) {
# Returns a list of lm_sensors names, values and maxes
sub get_sensors_values
{
-if (!length(@get_sensors_cache)) {
+if (!scalar(@get_sensors_cache)) {
local @rv;
open(SENS, "sensors 2>/dev/null |");
while(<SENS>) {
# Parses the syslog-ng config file into an array ref of objects
sub get_config
{
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
# First read file into tokens
@get_config_cache = &read_config_file($config{'syslogng_conf'});
}
$download{'dir'} = $in{'dir'};
if ($can_mode != 3) {
# User can be entered
- length(@uinfo = getpwnam($in{'user'})) || &error($text{'upload_euser'});
+ scalar(@uinfo = getpwnam($in{'user'})) || &error($text{'upload_euser'});
&can_as_user($in{'user'}) ||
&error(&text('download_eucannot', $in{'user'}));
$download{'uid'} = $uinfo[2];
- $in{'group_def'} || length(@ginfo = getgrnam($in{'group'})) ||
+ $in{'group_def'} || scalar(@ginfo = getgrnam($in{'group'})) ||
&error($text{'upload_egroup'});
$can_mode == 0 || $in{'group_def'} || &in_group(\@uinfo, \@ginfo) ||
&error($text{'download_egcannot'});
- $download{'gid'} = length(@ginfo) ? $ginfo[2] : $uinfo[3];
+ $download{'gid'} = scalar(@ginfo) ? $ginfo[2] : $uinfo[3];
}
else {
# User is fixed
}
if ($can_mode != 3) {
# User can be entered
- length(@uinfo = getpwnam($in{'user'})) ||
+ scalar(@uinfo = getpwnam($in{'user'})) ||
&error($text{'upload_euser'});
&can_as_user($in{'user'}) ||
&error(&text('upload_eucannot', $in{'user'}));
- $in{'group_def'} || length(@ginfo = getgrnam($in{'group'})) ||
+ $in{'group_def'} || scalar(@ginfo = getgrnam($in{'group'})) ||
&error($text{'upload_egroup'});
$can_mode == 0 || $in{'group_def'} || &in_group(\@uinfo, \@ginfo) ||
&error($text{'upload_egcannot'});
&error(&text('upload_eaccess', "<tt>$in{'dir'}</tt>", $!));
# Switch to the upload user
-&switch_uid_to($uinfo[2], length(@ginfo) ? $ginfo[2] : $uinfo[3]);
+&switch_uid_to($uinfo[2], scalar(@ginfo) ? $ginfo[2] : $uinfo[3]);
# Create the directory if needed
if (!-d $in{'dir'} && $in{'mkdir'}) {
# Doesn't look possible
$err = $text{'upload_notcomp'};
}
- &switch_uid_to($uinfo[2], length(@ginfo) ? $ginfo[2] : $uinfo[3]);
+ &switch_uid_to($uinfo[2], scalar(@ginfo) ? $ginfo[2] : $uinfo[3]);
if (!$err) {
local $j = join("<br>",
map { " <tt>$_</tt>" } @files);
=cut
sub list_users
{
-return @list_users_cache if (length(@list_users_cache));
+return @list_users_cache if (scalar(@list_users_cache));
# read the password file
local (@rv, $_, %idx, $lnum, @pw, $p, $i, $j);
"$_[0]->{'gid'}:$_[0]->{'class'}:$_[0]->{'change'}:".
"$_[0]->{'expire'}:$_[0]->{'real'}:$_[0]->{'home'}:".
"$_[0]->{'shell'}");
- if (length(@list_users_cache)) {
+ if (scalar(@list_users_cache)) {
map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
@list_users_cache;
}
# add to /etc/passwd
$lref = &read_file_lines($config{'passwd_file'});
$_[0]->{'line'} = &nis_index($lref);
- if (length(@list_users_cache)) {
+ if (scalar(@list_users_cache)) {
map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
@list_users_cache;
}
# Find correct place to insert in shadow file
$lref = &read_file_lines($config{'shadow_file'});
$_[0]->{'sline'} = &nis_index($lref);
- if (length(@list_users_cache)) {
+ if (scalar(@list_users_cache)) {
map { $_->{'sline'}++
if ($_->{'sline'} >= $_[0]->{'sline'}) }
@list_users_cache;
}
}
&flush_file_lines() if (!$batch_mode);
-push(@list_users_cache, $_[0]) if (length(@list_users_cache));
+push(@list_users_cache, $_[0]) if (scalar(@list_users_cache));
&refresh_nscd() if (!$batch_mode);
}
}
}
@list_users_cache = grep { $_->{'user'} ne $_[0]->{'user'} } @list_users_cache
- if (length(@list_users_cache));
+ if (scalar(@list_users_cache));
if (!$batch_mode) {
&flush_file_lines();
&refresh_nscd();
=cut
sub list_groups
{
-return @list_groups_cache if (length(@list_groups_cache));
+return @list_groups_cache if (scalar(@list_groups_cache));
local(@rv, $lnum, $_, %idx, $g, $i, $j, @gr);
$lnum = 0;
local $lref;
$lref = &read_file_lines($config{'group_file'});
$_[0]->{'line'} = &nis_index($lref);
- if (length(@list_groups_cache)) {
+ if (scalar(@list_groups_cache)) {
map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
@list_groups_cache;
}
if ($gft == 2) {
$lref = &read_file_lines($config{'gshadow_file'});
$_[0]->{'sline'} = &nis_index($lref);
- if (length(@list_groups_cache)) {
+ if (scalar(@list_groups_cache)) {
map { $_->{'sline'}++
if ($_->{'sline'} >= $_[0]->{'sline'}) }
@list_groups_cache;
&flush_file_lines();
}
&refresh_nscd();
-push(@list_groups_cache, $_[0]) if (length(@list_groups_cache));
+push(@list_groups_cache, $_[0]) if (scalar(@list_groups_cache));
}
=head2 modify_group(&old, &details)
}
}
@list_groups_cache = grep { $_ ne $_[0] } @list_groups_cache
- if (length(@list_groups_cache));
+ if (scalar(@list_groups_cache));
&refresh_nscd();
}
sub get_active_interface
{
local ($zinfo, $net) = @_;
-if (!length(@active_interfaces_cache)) {
+if (!scalar(@active_interfaces_cache)) {
@active_interfaces_cache = &net::active_interfaces();
}
local $address = $net->{'address'};
{
local ($zinfo, $fs) = @_;
local $dir = &get_zone_root($zinfo).$fs->{'dir'};
-if (!length(@active_mounts_cache)) {
+if (!scalar(@active_mounts_cache)) {
@active_mounts_cache = &mount::list_mounted();
}
local ($mount) = grep { $_->[0] eq $dir } @active_mounts_cache;