slirp: Fix spurious error report when sending directly
PATCH v2 1/1 slirp: Fix spurious error report when sending directly
Move check to where it actually is useful, and reduce scope of 'len' variable along the way.
---
Difference from v1:
- move check instead of initializing len.
slirp/socket.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
slirp/socket.c +7 -7
@@ -340,7 +340,7 @@ sosendoob(struct socket *so)struct sbuf *sb = &so->so_rcv;char buff[2048 ];/* XXX Shouldn't be sending more oob data than this */ -int n, len; +int n;DEBUG_CALL ("sosendoob" );DEBUG_ARG ("so = %p" , so);
@@ -359,7 +359,7 @@ sosendoob(struct socket *so)* send it all */ uint32_t urgc = so->so_urgc; - len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr; +int len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;if (len > urgc) { len = urgc; }
@@ -374,13 +374,13 @@ sosendoob(struct socket *so) len += n; } n =slirp_send (so, buff, len, (MSG_OOB ));/* |MSG_DONTWAIT)); */ - } -#ifdef DEBUG -if (n != len) { -DEBUG_ERROR ((dfd,"Didn't send all data urgently XXXXX\n" )); - } +if (n != len) { +DEBUG_ERROR ((dfd,"Didn't send all data urgently XXXXX\n" )); + }#endif + } +if (n <0 ) {return n; }
Signature · 1 line
2.17.0
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCHv2] slirp: Fix spurious error report when sending directly
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'6f4cceab40 slirp: Fix spurious error report when sending directly
=== OUTPUT BEGIN ===
Checking PATCH 1/1: slirp: Fix spurious error report when sending directly...
ERROR: code indent should never use tabs
#21: FILE: slirp/socket.c:343:
+^Iint n;$
ERROR: code indent should never use tabs
#30: FILE: slirp/socket.c:362:
+^I^Iint len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;$
ERROR: code indent should never use tabs
#39: FILE: slirp/socket.c:378:
+^I^Iif (n != len) {$
WARNING: line over 80 characters
#40: FILE: slirp/socket.c:379:
+ DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n"));
ERROR: code indent should never use tabs
#40: FILE: slirp/socket.c:379:
+^I^I^IDEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n"));$
ERROR: code indent should never use tabs
#41: FILE: slirp/socket.c:380:
+^I^I}$
total: 5 errors, 1 warnings, 34 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 4 lines · Samuel Thibault
Move check to where it actually is useful, and reduce scope of 'len' variable along the way.
Signed-off-by Samuel Thibault <[email protected]>
Thanks!
Quoted 50 lines
---
Difference from v1:
- move check instead of initializing len.slirp/socket.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)slirp/socket.c +7
-7@@ -340,7 +340,7 @@ sosendoob(struct socket *so)struct sbuf *sb = &so->so_rcv;char buff[2048 ];/* XXX Shouldn't be sending more oob data than this */ -int n, len; +int n;DEBUG_CALL ("sosendoob" );DEBUG_ARG ("so = %p" , so);@@ -359,7 +359,7 @@ sosendoob(struct socket *so)* send it all */ uint32_t urgc = so->so_urgc; - len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr; +int len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;if (len > urgc) { len = urgc; }@@ -374,13 +374,13 @@ sosendoob(struct socket *so) len += n; } n =slirp_send (so, buff, len, (MSG_OOB ));/* |MSG_DONTWAIT)); */ - } -#ifdef DEBUG -if (n != len) { -DEBUG_ERROR ((dfd,"Didn't send all data urgently XXXXX\n" )); - } +if (n != len) { +DEBUG_ERROR ((dfd,"Didn't send all data urgently XXXXX\n" )); + }#endif + } +if (n <0 ) {return n; }