diff options
author | Phil Davis <phil.davis@inf.org> | 2015-07-14 19:09:01 +0545 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2015-07-14 18:25:44 -0500 |
commit | 36f90078fbaf12510673f6e08dcf17db36d322fa (patch) | |
tree | 84386d91832f98c9dc118649aadb2368f70bc193 /usr/local | |
parent | 57945fccf315ec03600839640786f0de5da8ba56 (diff) | |
download | pfsense-36f90078fbaf12510673f6e08dcf17db36d322fa.zip pfsense-36f90078fbaf12510673f6e08dcf17db36d322fa.tar.gz |
Fix glob for serial device names
Removing the "." that was in {,.[0-9]} allows it to match /dev/cuau10 and onward.
I added lots of comments on the glob expression, because the format of the glob expression is not the same as an ordinary regex.
Diffstat (limited to 'usr/local')
-rw-r--r-- | usr/local/www/interfaces_ppps_edit.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php index a0a432f..490887f 100644 --- a/usr/local/www/interfaces_ppps_edit.php +++ b/usr/local/www/interfaces_ppps_edit.php @@ -442,7 +442,12 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE" if (!is_dir("/var/spool/lock")) mwexec("/bin/mkdir -p /var/spool/lock"); // $serialports = pfSense_get_modem_devices(); - $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); + // Match files in /dev starting with "cua" then: + // ? = any single character e.g. like "cuau" + // [0-9] = a digit from 0 to 9 + // {,[0-9]} = nothing (the empty before the comma) or a digit from 0 to 9 + // This supports up to 100 devices (0 to 99), e.g. cuau0 cuau1 ... cuau10 cuau11 ... cuau99 + $serialports = glob("/dev/cua?[0-9]{,[0-9]}", GLOB_BRACE); $serport_count = 0; foreach ($serialports as $port) { $serport_count++; |