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

fix some simple warnings #5

Merged

Conversation

infrastation
Copy link
Collaborator

No description provided.

gcc (Debian 12.2.0-14) 12.2.0

sniffit.c:1801:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1805:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1809:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1813:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1817:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1821:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1825:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1829:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1833:20: warning: extra tokens at end of #ifdef directive
sniffit.c:1837:20: warning: extra tokens at end of #ifdef directive
gcc (Debian 12.2.0-14) 12.2.0

sniffit.c:1523:20: warning: passing argument 2 of 'signal' from
  incompatible pointer type [-Wincompatible-pointer-types]
sniffit.c:1524:20: warning: passing argument 2 of 'signal' from
  incompatible pointer type [-Wincompatible-pointer-types]
sniffit.c:1525:20: warning: passing argument 2 of 'signal' from
  incompatible pointer type [-Wincompatible-pointer-types]

Make the function static while at it.
gcc (Debian 12.2.0-14) 12.2.0

sn_logfile.c:96:8: warning: passing argument 1 of 'fchmod' makes integer
  from pointer without a cast [-Wint-conversion]

fchmod() takes a file descriptor, not a pointer to FILE, so the call to
fchmod() always failed.  In order not to involve fileno(), just use
chmod(), which takes a pathname, which the function already knows.
@eribertomota
Copy link
Collaborator

Hi @infrastation!

Thanks a lot for your fixes. Currently, sniffit doesn't build over Debian Sid (unstable) and it is broken for the next Debian Stable. I saw you used Debian Stable with GCC 12. The current problem is with GCC 14. Please, see here[1].

[1] https://bugs.debian.org/1075521

Do you have time to check this issue? You could use a chroot environment to run a Debian Unstable and to make all checks and fixes. If you need, I can provide a tarball with a Debian Unstable up to use with chroot in a directory.

Should I merge the current changes?

Thanks in advance.

@infrastation
Copy link
Collaborator Author

This code is old and it has a number of issues of various severity. As far as I see it, there are two problems:

  1. The code has difficulty compiling and possibly working correctly in present-day world.
  2. The code does not have all the modern features of a packet analyzer.

In my opinion, problem 1 should be solved to preserve sniffit as a working example of a packet analyser from mid-1990s, and problem 2 should not be solved at all. Other people may have a different opinion, but in any case it would help to clean the source tree up. To that end, the source tree generates a lot of compiler warnings, some of which are just noise, some mean trivial problems and some mean more substantial and time-consuming problems. This pull request removes the easy warnings and makes problem 1 smaller, so yes, it is ready for merging in any case.

I had a look at the GCC 14 build error that says "error: returning ‘int’ from a function with return type ‘pcap_handler’..." (one of those that are an error in the GCC 14 build) and tried to fix it, but it requires a bit more work.

Regarding the setting up of a GCC 14 environment, that's not necessary at this point because the reason the GCC 14 build failed is that some of the pre-existing warnings became errors. The same warnings reproduce using my GCC 12.

@eribertomota eribertomota merged commit bf1d8b2 into resurrecting-open-source-projects:master Sep 18, 2024
1 check passed
@eribertomota
Copy link
Collaborator

In my opinion, problem 1 should be solved to preserve sniffit as a working example of a packet analyser from mid-1990s, and problem 2 should not be solved at all. Other people may have a different opinion, but in any case it would help to clean the source tree up. To that end, the source tree generates a lot of compiler warnings, some of which are just noise, some mean trivial problems and some mean more substantial and time-consuming problems. This pull request removes the easy warnings and makes problem 1 smaller, so yes, it is ready for merging in any case.

I strongly agree. Sniffit was the first source code that I compiled, in 1997. I packaged this program on Debian because of this.

Merged.

I had a look at the GCC 14 build error that says "error: returning ‘int’ from a function with return type ‘pcap_handler’..." (one of those that are an error in the GCC 14 build) and tried to fix it, but it requires a bit more work.

Thanks for your time.

Cheers,

Eriberto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants