Browse Source

api: check if name/desc/algo are NULL and fill with defaults if so.

Defaults should probably be specified elsewhere.
There should be a constructor for stuff like this.
This shit is really bringing me down.
refactor
Noel Maersk 10 years ago
parent
commit
5409ffc2a4
  1. 5
      api.c

5
api.c

@ -2178,6 +2178,11 @@ static void addpool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char * @@ -2178,6 +2178,11 @@ static void addpool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *
return;
}
/* If API client is old, it might not have provided all fields. */
if (name == NULL) name = strdup("");
if (desc == NULL) desc = strdup("");
if (algo == NULL) algo = strdup("scrypt"); // FIXME?
pool = add_pool();
detect_stratum(pool, url);
add_pool_details(pool, true, url, user, pass, name, desc, algo);

Loading…
Cancel
Save