diff mbox series

cpio: hint error reason on buffer fill failure

Message ID 20171006073721.11642-1-christian.storm@siemens.com
State Accepted
Headers show
Series cpio: hint error reason on buffer fill failure | expand

Commit Message

Storm, Christian Oct. 6, 2017, 7:37 a.m. UTC
Instead of only stating the failure, give a
more explicative error reason on failure.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 core/cpio_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic Oct. 6, 2017, 7:44 a.m. UTC | #1
Hi Christian,

On 06/10/2017 09:37, Christian Storm wrote:
> Instead of only stating the failure, give a
> more explicative error reason on failure.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  core/cpio_utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/core/cpio_utils.c b/core/cpio_utils.c
> index e8651a3..e962fae 100644
> --- a/core/cpio_utils.c
> +++ b/core/cpio_utils.c
> @@ -61,7 +61,7 @@ int fill_buffer(int fd, unsigned char *buf, unsigned int nbytes, unsigned long *
>  	while (nbytes > 0) {
>  		len = read(fd, buf, nbytes);
>  		if (len < 0) {
> -			ERROR("Failure in stream: I cannot go on\n");
> +			ERROR("Failure in stream %d: %s", fd, strerror(errno));
>  			return -EFAULT;
>  		}
>  		if (len == 0) {
> 

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Stefano Babic Oct. 9, 2017, 10:37 a.m. UTC | #2
On 06/10/2017 09:37, Christian Storm wrote:
> Instead of only stating the failure, give a
> more explicative error reason on failure.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  core/cpio_utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/core/cpio_utils.c b/core/cpio_utils.c
> index e8651a3..e962fae 100644
> --- a/core/cpio_utils.c
> +++ b/core/cpio_utils.c
> @@ -61,7 +61,7 @@ int fill_buffer(int fd, unsigned char *buf, unsigned int nbytes, unsigned long *
>  	while (nbytes > 0) {
>  		len = read(fd, buf, nbytes);
>  		if (len < 0) {
> -			ERROR("Failure in stream: I cannot go on\n");
> +			ERROR("Failure in stream %d: %s", fd, strerror(errno));
>  			return -EFAULT;
>  		}
>  		if (len == 0) {
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/core/cpio_utils.c b/core/cpio_utils.c
index e8651a3..e962fae 100644
--- a/core/cpio_utils.c
+++ b/core/cpio_utils.c
@@ -61,7 +61,7 @@  int fill_buffer(int fd, unsigned char *buf, unsigned int nbytes, unsigned long *
 	while (nbytes > 0) {
 		len = read(fd, buf, nbytes);
 		if (len < 0) {
-			ERROR("Failure in stream: I cannot go on\n");
+			ERROR("Failure in stream %d: %s", fd, strerror(errno));
 			return -EFAULT;
 		}
 		if (len == 0) {