sk-tcp: Print libsoccr_save() error message

Submitted by Kirill Tkhai on Aug. 30, 2017, 12:28 p.m.

Details

Message ID 150409609603.18734.1205248826512238027.stgit@localhost.localdomain
State Accepted
Series "sk-tcp: Print libsoccr_save() error message"
Commit f392198205099f03f0ffd494306f79083a14e73b
Headers show

Commit Message

Kirill Tkhai Aug. 30, 2017, 12:28 p.m.
Improve dump_tcp_conn_state() *debugibility*.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/sk-tcp.c |    4 +++-
 soccr/soccr.c |    4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index 3f9342495..c4354b345 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -114,8 +114,10 @@  static int dump_tcp_conn_state(struct inet_sk_desc *sk)
 	struct libsoccr_sk_data data;
 
 	ret = libsoccr_save(socr, &data, sizeof(data));
-	if (ret < 0)
+	if (ret < 0) {
+		pr_err("libsoccr_save() failed with %d\n", ret);
 		goto err_r;
+	}
 	if (ret != sizeof(data)) {
 		pr_err("This libsocr is not supported (%d vs %d)\n",
 				ret, (int)sizeof(data));
diff --git a/soccr/soccr.c b/soccr/soccr.c
index 583f1eaaa..48469aaab 100644
--- a/soccr/soccr.c
+++ b/soccr/soccr.c
@@ -374,10 +374,10 @@  int libsoccr_save(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigne
 	sk->flags |= SK_FLAG_FREE_SQ | SK_FLAG_FREE_RQ;
 
 	if (get_queue(sk->fd, TCP_RECV_QUEUE, &data->inq_seq, data->inq_len, &sk->recv_queue))
-		return -4;
+		return -5;
 
 	if (get_queue(sk->fd, TCP_SEND_QUEUE, &data->outq_seq, data->outq_len, &sk->send_queue))
-		return -5;
+		return -6;
 
 	return sizeof(struct libsoccr_sk_data);
 }

Comments

Andrey Vagin Aug. 30, 2017, 9:42 p.m.
Applied, thanks!
On Wed, Aug 30, 2017 at 03:28:23PM +0300, Kirill Tkhai wrote:
> Improve dump_tcp_conn_state() *debugibility*.
> 
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
> ---
>  criu/sk-tcp.c |    4 +++-
>  soccr/soccr.c |    4 ++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
> index 3f9342495..c4354b345 100644
> --- a/criu/sk-tcp.c
> +++ b/criu/sk-tcp.c
> @@ -114,8 +114,10 @@ static int dump_tcp_conn_state(struct inet_sk_desc *sk)
>  	struct libsoccr_sk_data data;
>  
>  	ret = libsoccr_save(socr, &data, sizeof(data));
> -	if (ret < 0)
> +	if (ret < 0) {
> +		pr_err("libsoccr_save() failed with %d\n", ret);
>  		goto err_r;
> +	}
>  	if (ret != sizeof(data)) {
>  		pr_err("This libsocr is not supported (%d vs %d)\n",
>  				ret, (int)sizeof(data));
> diff --git a/soccr/soccr.c b/soccr/soccr.c
> index 583f1eaaa..48469aaab 100644
> --- a/soccr/soccr.c
> +++ b/soccr/soccr.c
> @@ -374,10 +374,10 @@ int libsoccr_save(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigne
>  	sk->flags |= SK_FLAG_FREE_SQ | SK_FLAG_FREE_RQ;
>  
>  	if (get_queue(sk->fd, TCP_RECV_QUEUE, &data->inq_seq, data->inq_len, &sk->recv_queue))
> -		return -4;
> +		return -5;
>  
>  	if (get_queue(sk->fd, TCP_SEND_QUEUE, &data->outq_seq, data->outq_len, &sk->send_queue))
> -		return -5;
> +		return -6;
>  
>  	return sizeof(struct libsoccr_sk_data);
>  }
>