mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
The ERRMSG_EXIT macro is a bit clunky in its usage and a change is necessary in order to free memory in error cases. Create a new function error() that takes only a format string and adds all other relevant information by itself. This function frees memory before terminating the program with the EXIT_FAILURE exit code. This simplifies the error handling for pretty much all calls and makes the code a bit cleaner. While at it, the defines EXIT_MISUSE and EXIT_BUSY don't provide any value. Neither are they documented nor are these standardized. Also, a parent process is mostly interessted in success or failure only anyway. Replace these by using only EXIT_FAILURE in the error() function. Also, change multiline output to a combination of warnx and error to have a uniformed output. So this: WARNING: Device is formatted with a different blocksize (4096). Use --mode=full to perform a clean format. becomes this: dasdfmt: WARNING: Device is formatted with a different blocksize (4096). dasdfmt: Use --mode=full to perform a clean format. Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>