From cc639b18a49d6fad569b178ba85d1e014c131257 Mon Sep 17 00:00:00 2001 From: JohnnySun Date: Fri, 6 Mar 2015 09:52:50 +0800 Subject: [PATCH] When user running ss-local but not input any argument, ss-local will try to use ./config(if exist). bettter way. change default config path as /etc/shadowsocks/config.json When user running ss-local but not input any argument, ss-local will try to use ./config(if exist). Fixed the indent --- src/common.h | 2 ++ src/local.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/common.h b/src/common.h index 1894568f..de8e0460 100644 --- a/src/common.h +++ b/src/common.h @@ -37,6 +37,8 @@ #endif +#define DEFAULT_CONF_PATH "/etc/shadowsocks/config.json" + #ifndef SOL_TCP #define SOL_TCP IPPROTO_TCP #endif diff --git a/src/local.c b/src/local.c index 13d4748a..3439d944 100644 --- a/src/local.c +++ b/src/local.c @@ -963,6 +963,11 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } + if (argc == 1) { + if (conf_path == NULL) { + conf_path = DEFAULT_CONF_PATH; + } + } if (conf_path != NULL) { jconf_t *conf = read_jconf(conf_path); if (remote_num == 0) {