Skip to content
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

More coverity fixes #165

Merged
merged 10 commits into from Mar 29, 2015
Merged

More coverity fixes #165

merged 10 commits into from Mar 29, 2015

Conversation

@acv
Copy link
Contributor

@acv acv commented Mar 27, 2015

Fixes 4 new warning I introduced and a bunch of other warnings.

Also removed most extern definitions. Too many C files knew too much about the innards of other files!

sock = socket(PF_UNIX, SOCK_STREAM, 0);
if (-1 == (sock = socket(PF_UNIX, SOCK_STREAM, 0))) {
debug(LOG_ERR, "Could not created wdctl socket (%s)", strerror(errno));
exit(1);

This comment has been minimized.

@mhaas

mhaas Mar 27, 2015
Contributor

Didn't you want me to call terminate here? Or is that automatically called on exit()?

This comment has been minimized.

@acv

acv Mar 27, 2015
Author Contributor

I will change to terminate everywhere.

debug(LOG_ERR, "Could not bind control socket: %s",
strerror(errno));
close(wdctl_socket_server);
pthread_exit(NULL);
}

This comment has been minimized.

@mhaas

mhaas Mar 27, 2015
Contributor

Pthread_exit, exit or terminate?

This comment has been minimized.

@acv

acv Mar 27, 2015
Author Contributor

I will change to terminate all calls to pthread_exit() in this file.

debug(LOG_ERR, "Could not bind internal socket: %s", strerror(errno));
close(sock);
return;
}

if (listen(sock, 5)) {

This comment has been minimized.

@mhaas

mhaas Mar 27, 2015
Contributor

This check should be for -1?

Quoting the man page:

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

This comment has been minimized.

@acv

acv Mar 27, 2015
Author Contributor

I like explicit, but technically, -1 == true in C. Or more correctly false == 0 && true == !false

This comment has been minimized.

@mhaas

mhaas Mar 27, 2015
Contributor

Yeah, but I'd be good to have it explicit for the less gifted like me. I typically do Python and Java ;)

This comment has been minimized.

@acv

acv Mar 27, 2015
Author Contributor

I'll take a chainsaw to that file and refactor the network calls into discrete function and try to make it clearer. There's already too much duplication for my taste.

acv added 2 commits Mar 28, 2015
…coverity-pass

Conflicts:
	src/commandline.c
	src/gateway.c
	src/gateway.h
	src/simple_http.c
	src/wdctl_thread.c
@acv
Copy link
Contributor Author

@acv acv commented Mar 28, 2015

Merged in @mhaas's fixes and some comments.

mhaas added a commit that referenced this pull request Mar 29, 2015
More coverity fixes
@mhaas mhaas merged commit ce6de47 into wifidog:master Mar 29, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@florida63 florida63 added this to the 1.2.1 milestone Mar 29, 2015
@acv acv deleted the acv:new-coverity-pass branch Mar 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.