tree-wide: print error if table_print() fails
We generally want to print an error message if table_print() fails. Add a helper function for this and use it consistently. This does one of the three things depending on the call site: - a no-change reformatting of the code - change from a custom message to the generic one - addition of the error message where previously none was printed In the third case, the actual use impact is very small, since the table formatting is very unlikely to fail. But if it did, we would often return an error without any message whatsoever, which we never want to do.
This commit is contained in:
@@ -125,9 +125,5 @@ int list_enrolled(struct crypt_device *cd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = table_print(t);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to show slot table: %m");
|
||||
|
||||
return 0;
|
||||
return table_print_or_warn(t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user