Skip to content

Commit

Permalink
conf: support space in filename
Browse files Browse the repository at this point in the history
  • Loading branch information
pymumu committed Dec 14, 2022
1 parent 90e0be9 commit f8f1a66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package/openwrt/files/etc/init.d/smartdns
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ load_domain_rules()

config_get forwarding_domain_set_file "$section" "forwarding_domain_set_file" ""
[ ! -z "$forwarding_domain_set_file" ] && {
conf_append "domain-set" "-name ${domain_set_name}-forwarding-file -file $forwarding_domain_set_file"
conf_append "domain-set" "-name ${domain_set_name}-forwarding-file -file '$forwarding_domain_set_file'"
conf_append "domain-rules" "/domain-set:${domain_set_name}-forwarding-file/ $domain_set_args"
}

Expand All @@ -292,7 +292,7 @@ load_domain_rules()

config_get block_domain_set_file "$section" "block_domain_set_file"
[ ! -z "$block_domain_set_file" ] && {
conf_append "domain-set" "-name ${domain_set_name}-block-file -file $block_domain_set_file"
conf_append "domain-set" "-name ${domain_set_name}-block-file -file '$block_domain_set_file'"
conf_append "domain-rules" "/domain-set:${domain_set_name}-block-file/ -group block"
}

Expand Down Expand Up @@ -361,7 +361,7 @@ conf_append_conf_files()
fi

[ -f "$fullpath" ] && {
conf_append "conf-file" "$fullpath"
conf_append "conf-file" "'$fullpath'"
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ static int conf_parse_args(char *key, char *value, int *argc, char **argv)
continue;
}

if (*ptr == '"' && start == NULL) {
sep_flag = '"';
if ((*ptr == '"' || *ptr == '\'') && start == NULL) {
sep_flag = *ptr;
start = NULL;
}

Expand Down

0 comments on commit f8f1a66

Please sign in to comment.