From: Hugo Villeneuve Date: Mon, 17 Nov 2025 18:52:16 +0000 (-0500) Subject: Fix error handling X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=HEAD;p=mtlv.git Fix error handling Signed-off-by: Hugo Villeneuve --- diff --git a/src/main.c b/src/main.c index 145ec8c..aa7cccc 100644 --- a/src/main.c +++ b/src/main.c @@ -106,10 +106,8 @@ main(int argc, char **argv) tlvinfo_default_tlv(eeprom); rc = prog_eeprom(eeprom); - if (rc) { - log_err("Error writing TLV EEPROM\n"); + if (rc) exit(EXIT_FAILURE); - } exit(EXIT_SUCCESS); } @@ -130,21 +128,19 @@ main(int argc, char **argv) if (options.tlv_cmd == TLV_CMD_ADD) { rc = tlvinfo_add_tlv(eeprom, options.tlv_key, options.tlv_value); - if (rc == false) { - log_err("Error setting TLV key\n"); + if (rc == false) exit(EXIT_FAILURE); - } } else if (options.tlv_cmd == TLV_CMD_DEL) { rc = tlvinfo_delete_tlv(eeprom, options.tlv_key); - if (rc == false) { - log_err("Error deleting TLV key\n"); + if (rc == false) exit(EXIT_FAILURE); - } } else if (options.tlv_cmd == TLV_CMD_LIST) { show_tlv_code_list(); } else { if (options.tlv_key > 0) { - (void) tlvinfo_show_tlv(eeprom, options.tlv_key); + rc = tlvinfo_show_tlv(eeprom, options.tlv_key); + if (rc == false) + exit(EXIT_FAILURE); } else show_eeprom(eeprom); }