mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-11 05:32:16 +00:00
Change ok testing logic in breakdown() in bflsc and return if not ok at any stage.
This commit is contained in:
parent
6ff7893fdd
commit
cb914ab53f
@ -142,7 +142,7 @@ enum breakmode {
|
|||||||
static bool breakdown(enum breakmode mode, char *buf, int *count, char **firstname, char ***fields, char **lf)
|
static bool breakdown(enum breakmode mode, char *buf, int *count, char **firstname, char ***fields, char **lf)
|
||||||
{
|
{
|
||||||
char *ptr, *colon, *comma;
|
char *ptr, *colon, *comma;
|
||||||
bool ok;
|
bool ok = false;
|
||||||
|
|
||||||
#define p_count (*count)
|
#define p_count (*count)
|
||||||
#define p_firstname (*firstname)
|
#define p_firstname (*firstname)
|
||||||
@ -155,7 +155,7 @@ static bool breakdown(enum breakmode mode, char *buf, int *count, char **firstna
|
|||||||
p_lf = NULL;
|
p_lf = NULL;
|
||||||
|
|
||||||
if (!buf || !(*buf))
|
if (!buf || !(*buf))
|
||||||
return false;
|
return ok;
|
||||||
|
|
||||||
ptr = p_firstname = strdup(buf);
|
ptr = p_firstname = strdup(buf);
|
||||||
p_lf = strchr(p_firstname, '\n');
|
p_lf = strchr(p_firstname, '\n');
|
||||||
@ -165,20 +165,19 @@ static bool breakdown(enum breakmode mode, char *buf, int *count, char **firstna
|
|||||||
ptr = colon;
|
ptr = colon;
|
||||||
*(ptr++) = '\0';
|
*(ptr++) = '\0';
|
||||||
} else
|
} else
|
||||||
ok = false;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*ptr == ' ')
|
while (*ptr == ' ')
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
ok = true;
|
|
||||||
while (ptr && *ptr) {
|
while (ptr && *ptr) {
|
||||||
if (mode == ALLCOLON) {
|
if (mode == ALLCOLON) {
|
||||||
colon = strchr(ptr, ':');
|
colon = strchr(ptr, ':');
|
||||||
if (colon)
|
if (colon)
|
||||||
ptr = colon + 1;
|
ptr = colon + 1;
|
||||||
else
|
else
|
||||||
ok = false;
|
return ok;
|
||||||
}
|
}
|
||||||
while (*ptr == ' ')
|
while (*ptr == ' ')
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -192,6 +191,7 @@ static bool breakdown(enum breakmode mode, char *buf, int *count, char **firstna
|
|||||||
ptr = comma;
|
ptr = comma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ok = true;
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user