mirror of
https://github.com/GOSTSec/sgminer
synced 2025-08-26 13:52:02 +00:00
config: write pool name and description to config.
This commit is contained in:
parent
2c00158216
commit
da667d63e0
9
pool.c
9
pool.c
@ -22,9 +22,6 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* 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
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* This file was originally written by Colin Percival as part of the Tarsnap
|
|
||||||
* online backup system.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -37,17 +34,17 @@
|
|||||||
|
|
||||||
char* get_pool_name(struct pool *pool) {
|
char* get_pool_name(struct pool *pool) {
|
||||||
if (opt_incognito)
|
if (opt_incognito)
|
||||||
return "<pool>";
|
return "<pool>";
|
||||||
|
|
||||||
if (strcmp(pool->name, "") == 0)
|
if (strcmp(pool->name, "") == 0)
|
||||||
return pool->sockaddr_url;
|
return pool->sockaddr_url;
|
||||||
|
|
||||||
return pool->name;
|
return pool->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_pool_user(struct pool *pool) {
|
char* get_pool_user(struct pool *pool) {
|
||||||
if (opt_incognito)
|
if (opt_incognito)
|
||||||
return "<user>";
|
return "<user>";
|
||||||
|
|
||||||
return pool->rpc_user;
|
return pool->rpc_user;
|
||||||
}
|
}
|
||||||
|
@ -4274,6 +4274,13 @@ void write_config(FILE *fcfg)
|
|||||||
for(i = 0; i < total_pools; i++) {
|
for(i = 0; i < total_pools; i++) {
|
||||||
struct pool *pool = 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) {
|
if (pool->quota != 1) {
|
||||||
fprintf(fcfg, "%s\n\t{\n\t\t\"quota\" : \"%s%s%s%d;%s\",", i > 0 ? "," : "",
|
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)) : "",
|
pool->rpc_proxy ? json_escape((char *)proxytype(pool->rpc_proxytype)) : "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user