[bled] improve error reporting

* Also make the use of a FIXED drive more noticeable in the log
This commit is contained in:
Pete Batard 2017-01-11 01:12:00 +00:00
parent 8aeaa4d645
commit e62ab37e38
6 changed files with 21 additions and 21 deletions

View file

@ -28,7 +28,7 @@ jmp_buf bb_error_jmp;
static long long int unpack_none(transformer_state_t *xstate)
{
bb_printf("This compression type is not supported");
bb_error_msg("This compression type is not supported");
return -1;
}
@ -60,18 +60,18 @@ int64_t bled_uncompress(const char* src, const char* dst, int type)
xstate.src_fd = _openU(src, _O_RDONLY | _O_BINARY, 0);
if (xstate.src_fd < 0) {
bb_printf("Could not open '%s' (errno: %d)", src, errno);
bb_error_msg("Could not open '%s' (errno: %d)", src, errno);
goto err;
}
xstate.dst_fd = _openU(dst, _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY, _S_IREAD | _S_IWRITE);
if (xstate.dst_fd < 0) {
bb_printf("Could not open '%s' (errno: %d)", dst, errno);
bb_error_msg("Could not open '%s' (errno: %d)", dst, errno);
goto err;
}
if ((type < 0) || (type >= BLED_COMPRESSION_MAX)) {
bb_printf("unsupported compression format");
bb_error_msg("Unsupported compression format");
goto err;
}
@ -106,18 +106,18 @@ int64_t bled_uncompress_with_handles(HANDLE hSrc, HANDLE hDst, int type)
xstate.src_fd = _open_osfhandle((intptr_t)hSrc, _O_RDONLY);
if (xstate.src_fd < 0) {
bb_printf("Could not get source descriptor (errno: %d)", errno);
bb_error_msg("Could not get source descriptor (errno: %d)", errno);
return -1;
}
xstate.dst_fd = _open_osfhandle((intptr_t)hDst, 0);
if (xstate.dst_fd < 0) {
bb_printf("Could not get target descriptor (errno: %d)", errno);
bb_error_msg("Could not get target descriptor (errno: %d)", errno);
return -1;
}
if ((type < 0) || (type >= BLED_COMPRESSION_MAX)) {
bb_printf("unsupported compression format");
bb_error_msg("Unsupported compression format");
return -1;
}
@ -143,7 +143,7 @@ int64_t bled_uncompress_to_buffer(const char* src, char* buf, size_t size, int t
xstate.src_fd = _openU(src, _O_RDONLY | _O_BINARY, 0);
if (xstate.src_fd < 0) {
bb_printf("Could not open '%s' (errno: %d)", src, errno);
bb_error_msg("Could not open '%s' (errno: %d)", src, errno);
goto err;
}
@ -152,7 +152,7 @@ int64_t bled_uncompress_to_buffer(const char* src, char* buf, size_t size, int t
xstate.mem_output_size_max = size;
if ((type < 0) || (type >= BLED_COMPRESSION_MAX)) {
bb_printf("unsupported compression format");
bb_error_msg("Unsupported compression format");
goto err;
}