From 4f4587097011280fecff9f3ffaebc5d7676c2398 Mon Sep 17 00:00:00 2001 From: JohnnySun Date: Fri, 6 Mar 2015 12:50:57 +0800 Subject: [PATCH] Add try to use /etc/shadowsocks/config.json for ss-redir ss-server ss-tunnel. --- src/redir.c | 9 ++++++++- src/server.c | 8 +++++++- src/tunnel.c | 8 +++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/redir.c b/src/redir.c index fd32b9ed..5ffec264 100644 --- a/src/redir.c +++ b/src/redir.c @@ -47,6 +47,7 @@ #include "netutils.h" #include "utils.h" +#include "common.h" #include "redir.h" #ifndef EAGAIN @@ -653,7 +654,13 @@ int main(int argc, char **argv) usage(); 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) { diff --git a/src/server.c b/src/server.c index 1f5e3843..1f5bc804 100644 --- a/src/server.c +++ b/src/server.c @@ -1154,7 +1154,13 @@ int main(int argc, char **argv) usage(); 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 (server_num == 0) { diff --git a/src/tunnel.c b/src/tunnel.c index fb90bf67..70d687c8 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -709,7 +709,13 @@ int main(int argc, char **argv) usage(); 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) {