You are here

Fix for uci_set_indexed_option() inserting multiple empty sections

3 posts / 0 new
Last post
K3PGM
K3PGM's picture
Fix for uci_set_indexed_option() inserting multiple empty sections
I haven't quite figured out the whole pull-request thing yet, but in the meantime, here's a fix for the problem of multiple empty "network" sections being inserted into /etc/config/vtun whenever you add a tunnel:
*** aredn_ar71xx/openwrt/files/www/cgi-bin/ucifunc.pm   Mon Oct 26 15:47:22 2020
--- aredn_ar71xx/openwrt/files/www/cgi-bin/ucifunc.pm.NEW       Sun Mar 14 14:59:56 2021
***************
*** 38,44 ****
  sub uci_get_sectiontype_count()
  {
      my ($config, $stype)=@_;
!     my $cmd=sprintf('uci show %s|egrep %s\.\@%s.*=%s|wc -l',$config,$stype,$stype,$stype);
      my $res=`$cmd`;
      my $rc=$?;
      chomp($res);
--- 38,44 ----
  sub uci_get_sectiontype_count()
  {
      my ($config, $stype)=@_;
!     my $cmd=sprintf('uci show %s|egrep %s\.\@%s.*=%s|wc -l',$config,$config,$stype,$stype);
      my $res=`$cmd`;
      my $rc=$?;
      chomp($res);

73,
- Paul, K3PGM


 
K5DLQ
K5DLQ's picture
Ah!  Good find, thank you!
Ah!  Good find, thank you!
K3PGM
K3PGM's picture
OK; I've created a pull request now.
Thanks to a pointer from Steve AB7PA, I've figured out how to make a pull request out of the above fix. If it's still not quite right, please let me know.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer