New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: Fix unused variable references warnings #14790

Merged
merged 2 commits into from May 2, 2017

Conversation

Projects
None yet
3 participants
@wjwithagen
Contributor

wjwithagen commented Apr 25, 2017

  • FreeBSD excludes some that that causes unused warnings

Signed-off-by: Willem Jan Withagen wjw@digiware.nl

@wjwithagen wjwithagen requested a review from tchaikov Apr 25, 2017

@@ -44,7 +44,7 @@ int NetHandler::create_socket(int domain, bool reuse_addr)
/* Make sure connection-intensive things like the benchmark
* will be able to close/open sockets a zillion of times */
if (reuse_addr) {
if (::setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
if (::setsockopt(s, SOL_SOCKET, SO_REUSEADDR, nullptr, 0) == -1) {

This comment has been minimized.

@liewegas

liewegas Apr 25, 2017

Member

I don't think this is right. From teh man page,

       Most socket-level options utilize an int argument for optval.  For setsockopt(), the argument  should  be  nonzero  to  enable  a  boolean
       option, or zero if the option is to be disabled.

We're enabling the option, so I think we need to pass the (non-zero) int value.

This comment has been minimized.

@tchaikov

tchaikov Apr 26, 2017

Contributor

@wjwithagen sorry, i was wrong. we do need to pass a non-zero variable to setsockopt() here.

This comment has been minimized.

@wjwithagen

wjwithagen Apr 26, 2017

Contributor

@liewegas @tchaikov
I just looked for the suggestion, and did find the text. But the getsockopt() part eluded me.
Will take it out.

@liewegas liewegas changed the title from Cleanup: Fix unused variable references warnings to common: Fix unused variable references warnings Apr 25, 2017

if (prio >= 0) {
int r = -1;
int r;

This comment has been minimized.

@tchaikov

tchaikov Apr 26, 2017

Contributor

i don't think this helps. instead, i posted a patch at #14795 to explain what i imagined in the first place.

wjwithagen added some commits Apr 25, 2017

msg/async/net_handler.cc: fix unused reference for option
 - If no option value is to be supplied or returned,
     optval may be NULL
 - ignore priority options for FreeBSD

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
os/filestore/FileJournal.cc: fix unused warning
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
@wjwithagen

This comment has been minimized.

Contributor

wjwithagen commented May 1, 2017

@tchaikov
I noticed that I had not rebased this one. Just fixed that.

@liewegas liewegas merged commit d3b461e into ceph:master May 2, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment