Skip to content

Commit d015d57

Browse files
committed
rimage: toml_utils: fix errno handling in parse_uint32_hex_key
Fix errno handling Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>#
1 parent dff8e55 commit d015d57

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/rimage/src/toml_utils.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ uint32_t parse_uint32_hex_key(const toml_table_t *table, struct parse_ctx *ctx,
151151
*error = err_key_parse(key, NULL);
152152
return UINT32_MAX;
153153
}
154+
errno = 0;
154155
val = strtoul(temp_s, 0, 0);
155156

156157
free(temp_s);
157158
/* assert parsing success and value is within uint32_t range */
158-
if (errno < 0) {
159+
if (errno != 0) {
159160
*error = err_key_parse(key, "can't convert hex value");
160161
return UINT32_MAX;
161162
}

0 commit comments

Comments
 (0)