fix logic when updating modtimes

This commit is contained in:
Simon Marsh 2024-09-07 17:05:24 +01:00
parent 87cb850050
commit b2f88566d2
Signed by: burble
GPG Key ID: E9B4156C1659C079

View File

@ -57,7 +57,6 @@ declare -A interfaces
declare -A previous_modtimes declare -A previous_modtimes
declare -A add_interfaces declare -A add_interfaces
declare -A remove_interfaces declare -A remove_interfaces
modcount=0
if [ -f "$MODFILE" ] if [ -f "$MODFILE" ]
then then
@ -87,8 +86,6 @@ do
# if an interface has been modified, remove it then re-add it # if an interface has been modified, remove it then re-add it
remove_interfaces[$iface]=1 remove_interfaces[$iface]=1
add_interfaces[$iface]=1 add_interfaces[$iface]=1
modcount=$(( modcount + 1 ))
done done
########################################################################### ###########################################################################
@ -147,7 +144,8 @@ done
# all done # all done
# save the modified times if required # save the modified times if required
if [ "$modcount" -gt 0 ] if [ "${#add_interfaces[@]}" -gt 0 ] ||
[ "${#remove_interfaces[@]}" -gt 0 ]
then then
exec 3> "$MODFILE" exec 3> "$MODFILE"
for file in "${!modtimes[@]}" for file in "${!modtimes[@]}"