Skip to content

Commit

Permalink
Travis-ci seems to have a picky compiler
Browse files Browse the repository at this point in the history
lastloghelper.c:144:3: error: ISO C90 forbids mixed declarations and
code [-Werror=declaration-after-statement]
  • Loading branch information
jonathanstowe committed Oct 27, 2015
1 parent 33ee747 commit d73d58e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lastloghelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ struct p_lastlog *ll2p(struct lastlog *llent) {

if ( llent != NULL ) {
static char ll_line[sizeof(llent->ll_line) + 1];
static char ll_host[sizeof(llent->ll_host) + 1];
strncpy(ll_line,llent->ll_line, sizeof(llent->ll_line));
ll_line[sizeof(llent->ll_line)] = 0;
p_llent.ll_line = ll_line;
static char ll_host[sizeof(llent->ll_host) + 1];
strncpy(ll_host,llent->ll_host, sizeof(llent->ll_host));
ll_host[sizeof(llent->ll_host)] = 0;
p_llent.ll_host = ll_host;
Expand Down

3 comments on commit d73d58e

@JJ
Copy link
Contributor

@JJ JJ commented on d73d58e Feb 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alpine does not like that line either, but it's a warning:

[Sys::Lastlog] lastloghelper.c:142:41: warning: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
[Sys::Lastlog]    strncpy(ll_line,llent->ll_line, sizeof(llent->ll_line));
[Sys::Lastlog]

@jonathanstowe
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I had sorted that one. Let me look at that.

@jonathanstowe
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler is too clever, I've fixed it.

Please sign in to comment.