diff options
author | Jeff Garzik <jeff@garzik.org> | 2011-03-21 20:50:59 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2011-03-21 20:50:59 -0400 |
commit | 46819af36f0ae94e69333810ad0a03f472fc6d8e (patch) | |
tree | 50b107a8424580525016d98ee0bdb48c950a335f | |
parent | 594fe678fb2001417eddb5854c4a7d54a9c59a44 (diff) |
--user/--pass fixes
Also, some newline fixes (applog callers do not need newlines in strings)
-rw-r--r-- | cpu-miner.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cpu-miner.c b/cpu-miner.c index 12af724..7c941fd 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -171,7 +171,7 @@ static struct option_help options_help[] = { "(default: " DEF_RPC_USERNAME ")" }, { "pass PASSWORD", - "(-p USERNAME) Password for bitcoin JSON-RPC server " + "(-p PASSWORD) Password for bitcoin JSON-RPC server " "(default: " DEF_RPC_PASSWORD ")" }, }; @@ -668,10 +668,10 @@ static void *longpoll_thread(void *userdata) if (failures++ < 10) { sleep(30); applog(LOG_ERR, - "longpoll failed, sleeping for 30s\n"); + "longpoll failed, sleeping for 30s"); } else { applog(LOG_ERR, - "longpoll failed, ending thread\n"); + "longpoll failed, ending thread"); goto out; } } @@ -854,12 +854,15 @@ int main (int argc, char *argv[]) int i; rpc_url = strdup(DEF_RPC_URL); - rpc_userpass = strdup(DEF_RPC_USERPASS); /* parse command line */ parse_cmdline(argc, argv); - if (!rpc_userpass && rpc_user && rpc_pass) { + if (!rpc_userpass) { + if (!rpc_user || !rpc_pass) { + applog(LOG_ERR, "No login credentials supplied"); + return 1; + } rpc_userpass = malloc(strlen(rpc_user) + strlen(rpc_pass) + 2); if (!rpc_userpass) return 1; @@ -934,7 +937,7 @@ int main (int argc, char *argv[]) } applog(LOG_INFO, "%d miner threads started, " - "using SHA256 '%s' algorithm.\n", + "using SHA256 '%s' algorithm.", opt_n_threads, algo_names[opt_algo]); |