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 compilation issues with -Wall, add Makefile #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tonylambiris
Copy link

@tonylambiris tonylambiris commented Apr 24, 2019

Takes care of the following warnings:

findmacs.c: In function ‘main’:
findmacs.c:233:42: warning: pointer targets in passing argument 3 of ‘getMACs’ differ in signedness [-Wpointer-sign]
   matches = getMACs(fd, interface_index, interface_mac, interface_ip, target, flags, &mac_list_hash);
                                          ^~~~~~~~~~~~~
findmacs.c:69:5: note: expected ‘char *’ but argument is of type ‘unsigned char *’
 int getMACs(int fd, int interface_index, char mac[ETHER_ADDR_LEN], char * ip, char * target, int flags, struct hsearch_data *htab);
     ^~~~~~~
findmacs.c: In function ‘getMACs’:
findmacs.c:258:7: warning: unused variable ‘p’ [-Wunused-variable]
   int p, show = 0, matches = 0;
       ^
findmacs.c:250:18: warning: unused variable ‘target_ip_addr’ [-Wunused-variable]
   struct in_addr target_ip_addr = {0};
                  ^~~~~~~~~~~~~~
findmacs.c: In function ‘split_cidr_range’:
findmacs.c:412:20: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses]
   mask = mask << 32-count;
                  ~~^~~~~~

Compilation with added Makefile:

➜ make clean
rm -f findmacs
➜ make
gcc -Wall findmacs.c -o findmacs

Thanks!

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.

1 participant