Browse Source

config: write pool name and description to config.

refactor
Noel Maersk 11 years ago
parent
commit
da667d63e0
  1. 13
      pool.c
  2. 7
      sgminer.c

13
pool.c

@ -22,9 +22,6 @@ @@ -22,9 +22,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#include "config.h"
@ -37,17 +34,17 @@ @@ -37,17 +34,17 @@
char* get_pool_name(struct pool *pool) {
if (opt_incognito)
return "<pool>";
return "<pool>";
if (strcmp(pool->name, "") == 0)
return pool->sockaddr_url;
if (strcmp(pool->name, "") == 0)
return pool->sockaddr_url;
return pool->name;
}
char* get_pool_user(struct pool *pool) {
if (opt_incognito)
return "<user>";
if (opt_incognito)
return "<user>";
return pool->rpc_user;
}

7
sgminer.c

@ -4274,6 +4274,13 @@ void write_config(FILE *fcfg) @@ -4274,6 +4274,13 @@ void write_config(FILE *fcfg)
for(i = 0; i < total_pools; i++) {
struct pool *pool = pools[i];
/* Using get_pool_name() here is unsafe if opt_incognito is true. */
if (strcmp(pool->name, "") != 0) {
fprintf(fcfg, "\n\t\t\"name\" : \"%s\",", json_escape(pool->name));
}
if (strcmp(pool->description, "") != 0) {
fprintf(fcfg, "\n\t\t\"description\" : \"%s\",", json_escape(pool->description));
}
if (pool->quota != 1) {
fprintf(fcfg, "%s\n\t{\n\t\t\"quota\" : \"%s%s%s%d;%s\",", i > 0 ? "," : "",
pool->rpc_proxy ? json_escape((char *)proxytype(pool->rpc_proxytype)) : "",

Loading…
Cancel
Save