diff --git a/src/fw_printenv.c b/src/fw_printenv.c index 6a7a987..e934323 100644 --- a/src/fw_printenv.c +++ b/src/fw_printenv.c @@ -141,7 +141,7 @@ int main (int argc, char **argv) { */ ret = libuboot_read_config_ext(&ctx, cfgfname); if (ret) { - fprintf(stderr, "Cannot initialize environment\n"); + fprintf(stderr, "Cannot initialize environment: %d\n", ret); exit(1); } diff --git a/src/uboot_env.c b/src/uboot_env.c index ae85c7e..9c55e85 100644 --- a/src/uboot_env.c +++ b/src/uboot_env.c @@ -1698,17 +1698,21 @@ int libuboot_read_config_ext(struct uboot_ctx **ctxlist, const char *config) return -EINVAL; fp = fopen(config, "r"); - if (!fp) + if (!fp) { + fprintf(stderr, "Cannot open config %s\n", config); return -EBADF; + } if (!*ctxlist) { ret = parse_yaml_config(ctxlist, fp); if (!ret) { + fprintf(stderr, "Error parsing yaml: %d\n", ret); fclose(fp); return 0; } ret = libuboot_initialize(ctxlist, NULL); if (ret) { + fprintf(stderr, "libuboot_initialize: %d\n", ret); fclose(fp); return ret; } @@ -1753,6 +1757,7 @@ int libuboot_read_config_ext(struct uboot_ctx **ctxlist, const char *config) if (normalize_device_path(tmp, dev) < 0) { free(tmp); retval = -EINVAL; + fprintf(stderr, "normalize_device_path error\n"); break; } free(tmp); @@ -1760,6 +1765,7 @@ int libuboot_read_config_ext(struct uboot_ctx **ctxlist, const char *config) if (check_env_device(dev) < 0) { retval = -EINVAL; + fprintf(stderr, "check_env_device error\n"); break; } @@ -1768,13 +1774,17 @@ int libuboot_read_config_ext(struct uboot_ctx **ctxlist, const char *config) if (ndev >= 2) { ctx->redundant = true; - if (!check_compatible_devices(ctx)) + if (!check_compatible_devices(ctx)) { retval = -EINVAL; + fprintf(stderr, "check_compatible_devices error\n"); + } break; } } - if (ndev == 0) + if (ndev == 0) { retval = -EINVAL; + fprintf(stderr, "ndev == 0\n"); + } fclose(fp); free(line);