diff options
author | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2018-04-21 12:11:46 +0200 |
---|---|---|
committer | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2018-04-21 12:11:46 +0200 |
commit | 6d8f45f759e688b827173132636be2e0a12e1ed1 (patch) | |
tree | 2260865605ee2eda1ba1d8be9e4302370ebf4036 /net | |
parent | edd002dc3f6528c6dda394adc4be26969e6add65 (diff) |
ddns-scripts: fixes "sed: no previous regexp"
Rewritten Pull for #5885
When ran from the command line, the script prints
error messages like below. They are caused by supplying
empty "$password" and "$URL_PASS" for some log messages
like "130822 : Detect local IP on 'interface'".
The fix is to check if the values are not empty before running
through sed.
/etc/init.d/ddns start
sed: no previous regexp
Reported by Marc Benoit <marcb62185@gmail.com>
Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'net')
-rwxr-xr-x | net/ddns-scripts/Makefile | 2 | ||||
-rwxr-xr-x | net/ddns-scripts/files/dynamic_dns_functions.sh | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index 2150a4026..f8c63dec8 100755 --- a/net/ddns-scripts/Makefile +++ b/net/ddns-scripts/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=ddns-scripts PKG_VERSION:=2.7.7 # Release == build # increase on changes of services files or tld_names.dat -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com> diff --git a/net/ddns-scripts/files/dynamic_dns_functions.sh b/net/ddns-scripts/files/dynamic_dns_functions.sh index 90501ac69..c944fc2aa 100755 --- a/net/ddns-scripts/files/dynamic_dns_functions.sh +++ b/net/ddns-scripts/files/dynamic_dns_functions.sh @@ -262,9 +262,9 @@ write_log() { [ $VERBOSE -gt 0 -o $__EXIT -gt 0 ] && echo -e "$__MSG" # write to logfile if [ ${use_logfile:-1} -eq 1 -o $VERBOSE -gt 1 ]; then - printf "%s\n" "$__MSG" | \ - sed -e "s/$password/*password*/g; \ - s/$URL_PASS/*URL_PASS*/g" >> $LOGFILE + [ -n "$password" ] && __MSG=$( printf "%s" "$__MSG" | sed -e "s/$password/*password*/g" ) + [ -n "$URL_PASS" ] && __MSG=$( printf "%s" "$__MSG" | sed -e "s/$URL_PASS/*URL_PASS*/g" ) + printf "%s\n" "$__MSG" >> $LOGFILE # VERBOSE > 1 then NO loop so NO truncate log to $ddns_loglines lines [ $VERBOSE -gt 1 ] || sed -i -e :a -e '$q;N;'$ddns_loglines',$D;ba' $LOGFILE fi |