Skip to content

Fix more mostly benign Linux/GCC compiler warnings#827

Merged
zakird merged 1 commit intozmap:mainfrom
droe:droe/fix-even-more-compiler-warnings
Mar 15, 2024
Merged

Fix more mostly benign Linux/GCC compiler warnings#827
zakird merged 1 commit intozmap:mainfrom
droe:droe/fix-even-more-compiler-warnings

Conversation

@droe
Copy link
Contributor

@droe droe commented Mar 15, 2024

In file included from src/send-internal.h:23,
                 from src/send.c:31:
src/send-linux.h:25:27: warning: ‘sockaddr’ defined but not used [-Wunused-variable]
   25 | static struct sockaddr_ll sockaddr;
      |                           ^~~~~~~~
src/send.c: In function ‘send_run’:
src/send.c:457:30: warning: ‘attempts’ may be used uninitialized [-Wmaybe-uninitialized]
  457 |         if (!zconf.dryrun && send_batch(st, batch, attempts) < 0) {
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/send.c:303:13: note: ‘attempts’ was declared here
  303 |         int attempts = zconf.retries + 1;
      |             ^~~~~~~~
src/probe_modules/module_dns.c: In function ‘dns_global_initialize’:
src/probe_modules/module_dns.c:637:25: warning: ‘__builtin_strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
  637 |                         strncpy(domain_ptr, domain_token, domain_len);
      |                         ^
src/probe_modules/module_dns.c:634:43: note: length computed here
  634 |                         uint domain_len = strlen(domain_token);
      |                                           ^~~~~~~~~~~~~~~~~~~~

In file included from src/send-internal.h:23,
                 from src/send.c:31:
src/send-linux.h:25:27: warning: ‘sockaddr’ defined but not used [-Wunused-variable]
   25 | static struct sockaddr_ll sockaddr;
      |                           ^~~~~~~~
src/send.c: In function ‘send_run’:
src/send.c:457:30: warning: ‘attempts’ may be used uninitialized [-Wmaybe-uninitialized]
  457 |         if (!zconf.dryrun && send_batch(st, batch, attempts) < 0) {
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/send.c:303:13: note: ‘attempts’ was declared here
  303 |         int attempts = zconf.retries + 1;
      |             ^~~~~~~~
src/probe_modules/module_dns.c: In function ‘dns_global_initialize’:
src/probe_modules/module_dns.c:637:25: warning: ‘__builtin_strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
  637 |                         strncpy(domain_ptr, domain_token, domain_len);
      |                         ^
src/probe_modules/module_dns.c:634:43: note: length computed here
  634 |                         uint domain_len = strlen(domain_token);
      |                                           ^~~~~~~~~~~~~~~~~~~~
@zakird zakird merged commit 3939d83 into zmap:main Mar 15, 2024
@droe droe deleted the droe/fix-even-more-compiler-warnings branch March 25, 2024 23:32
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