[MacPorts] #63124: cryptcat @1.2.1: error: implicit declaration of function 'close' is invalid in C99

MacPorts noreply at macports.org
Tue Jun 22 02:38:57 UTC 2021


#63124: cryptcat @1.2.1: error: implicit declaration of function 'close' is invalid
in C99
-----------------------------+----------------------
 Reporter:  cooljeanius      |      Owner:  (none)
     Type:  defect           |     Status:  new
 Priority:  Normal           |  Milestone:
Component:  ports            |    Version:  2.7.1
 Keywords:  bigsur catalina  |       Port:  cryptcat
-----------------------------+----------------------
 Another victim of `-Werror=implicit-function-declaration` being on by
 default now:
 {{{
 cc -O   -c -o netcat.o netcat.c
 netcat.c:41:26: warning: '/*' within block comment [-Wcomment]
 /* #undef _POSIX_SOURCE         /* might need this for something? */
                                 ^
 netcat.c:44:19: warning: '/*' within block comment [-Wcomment]
 /* #define ANAL                 /* if you want case-sensitive DNS matching
 */
                                 ^
 netcat.c:208:19: warning: format string is not a string literal
 (potentially insecure) [-Wformat-security]
         fprintf (stderr, h_errs[h_errno]);      /* handle it here */
                          ^~~~~~~~~~~~~~~
 netcat.c:208:19: note: treat the string as an argument to avoid this
         fprintf (stderr, h_errs[h_errno]);      /* handle it here */
                          ^
                          "%s",
 netcat.c:228:3: error: implicit declaration of function 'close' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
   close (netfd);
   ^
 netcat.c:229:3: error: implicit declaration of function 'sleep' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
   sleep (1);
   ^
 netcat.c:239:42: warning: too few arguments in call to 'bail'
     bail (wrote_txt, wrote_net, wrote_out);
     ~~~~                                 ^
 netcat.c:239:22: warning: incompatible integer to pointer conversion
 passing 'unsigned int' to parameter of type 'char *' [-Wint-conversion]
     bail (wrote_txt, wrote_net, wrote_out);
                      ^~~~~~~~~
 netcat.c:239:33: warning: incompatible integer to pointer conversion
 passing 'unsigned int' to parameter of type 'char *' [-Wint-conversion]
     bail (wrote_txt, wrote_net, wrote_out);
                                 ^~~~~~~~~
 netcat.c:240:17: warning: too few arguments in call to 'bail'
   bail (" punt!");
   ~~~~          ^
 netcat.c:247:3: error: implicit declaration of function 'alarm' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
   alarm (0);
   ^
 netcat.c:249:38: warning: too few arguments in call to 'bail'
     bail ("spurious timer interrupt!");
     ~~~~                             ^
 netcat.c:261:5: error: implicit declaration of function 'alarm' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
     alarm (0);
     ^
 netcat.c:265:5: error: implicit declaration of function 'alarm' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
     alarm (secs);
     ^
 netcat.c:281:33: warning: too few arguments in call to 'bail'
     bail ("Hmalloc %d failed", s);
     ~~~~                        ^
 netcat.c:281:32: warning: incompatible integer to pointer conversion
 passing 'unsigned int' to parameter of type 'char *' [-Wint-conversion]
     bail ("Hmalloc %d failed", s);
                                ^
 netcat.c:331:69: warning: too few arguments in call to 'holler'
     holler ("DNS fwd/rev mismatch: %s != %s", poop->name, hp->h_name);
     ~~~~~~                                                          ^
 netcat.c:376:32: warning: too few arguments in call to 'bail'
     bail ("gethostpoop fuxored");
     ~~~~                       ^
 netcat.c:383:52: warning: too few arguments in call to 'bail'
       bail ("Can't parse %s as an IP address", name);
       ~~~~                                         ^
 netcat.c:387:53: warning: too few arguments in call to 'bail'
       bail ("%s: forward host lookup failed: ", name);
       ~~~~                                          ^
 netcat.c:403:18: warning: too few arguments in call to 'holler'
           poop->addrs[x]);
                         ^
 netcat.c:418:50: warning: too few arguments in call to 'holler'
         holler ("%s: inverse host lookup failed: ", name);
         ~~~~~~                                          ^
 netcat.c:424:13: warning: too few arguments in call to 'holler'
                 poop->name);
                           ^
 netcat.c:410:5: warning: 'strncpy' will always overflow; destination
 buffer has size 24, but size argument is 192 [-Wbuiltin-memcpy-chk-size]
     strncpy (poop->addrs[0], inet_ntoa (iaddr), sizeof (poop->addrs));
     ^
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/secure/_string.h:128:3:
 note: expanded from macro 'strncpy'
                 __builtin___strncpy_chk (dest, __VA_ARGS__, __darwin_obsz
 (dest))
                 ^
 netcat.c:469:56: warning: too few arguments in call to 'holler'
         holler ("Warning: port-bynum mismatch, %d != %d", x, y);
         ~~~~~~                                                ^
 netcat.c:469:52: warning: incompatible integer to pointer conversion
 passing 'int' to parameter of type 'char *' [-Wint-conversion]
         holler ("Warning: port-bynum mismatch, %d != %d", x, y);
                                                           ^
 netcat.c:469:55: warning: incompatible integer to pointer conversion
 passing 'int' to parameter of type 'char *' [-Wint-conversion]
         holler ("Warning: port-bynum mismatch, %d != %d", x, y);
                                                              ^
 netcat.c:567:34: warning: too few arguments in call to 'bail'
     bail ("loadports: no block?!");
     ~~~~                         ^
 netcat.c:569:51: warning: too few arguments in call to 'bail'
     bail ("loadports: bogus values %d, %d", lo, hi);
     ~~~~                                          ^
 netcat.c:569:45: warning: incompatible integer to pointer conversion
 passing 'unsigned short' to parameter of type 'char *' [-Wint-conversion]
     bail ("loadports: bogus values %d, %d", lo, hi);
                                             ^~
 netcat.c:569:49: warning: incompatible integer to pointer conversion
 passing 'unsigned short' to parameter of type 'char *' [-Wint-conversion]
     bail ("loadports: bogus values %d, %d", lo, hi);
                                                 ^~
 netcat.c:631:29: warning: too few arguments in call to 'bail'
     bail ("Can't get socket");
     ~~~~                    ^
 netcat.c:637:38: warning: too few arguments in call to 'holler'
     holler ("nnetfd reuseaddr failed");         /* ??? */
     ~~~~~~                           ^
 netcat.c:641:38: warning: too few arguments in call to 'holler'
     holler ("nnetfd reuseport failed");         /* ??? */
     ~~~~~~                           ^
 netcat.c:675:66: warning: too few arguments in call to 'holler'
         holler ("retrying local %s:%d", inet_ntoa (lclend->sin_addr), lp);
         ~~~~~~                                                          ^
 netcat.c:675:64: warning: incompatible integer to pointer conversion
 passing 'unsigned short' to parameter of type 'char *' [-Wint-conversion]
         holler ("retrying local %s:%d", inet_ntoa (lclend->sin_addr), lp);
                                                                       ^~
 netcat.c:676:2: error: implicit declaration of function 'sleep' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
         sleep (2);
         ^
 netcat.c:683:33: warning: too few arguments in call to 'bail'
         inet_ntoa(lclend->sin_addr), lp);
                                        ^
 netcat.c:683:31: warning: incompatible integer to pointer conversion
 passing 'unsigned short' to parameter of type 'char *' [-Wint-conversion]
         inet_ntoa(lclend->sin_addr), lp);
                                      ^~
 netcat.c:754:39: warning: too few arguments in call to 'bail'
       bail ("srcrt setsockopt fuxored");
       ~~~~                            ^
 netcat.c:771:3: error: implicit declaration of function 'close' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
   close (nnetfd);                       /* clean up junked socket FD!! */
   ^
 netcat.c:735:16: warning: implicit conversion from 'int' to 'char' changes
 value from 131 to -125 [-Wconstant-conversion]
       *opp++ = IPOPT_LSRR;                                      /* option
 */
              ~ ^~~~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/netinet/ip.h:172:33:
 note: expanded from macro 'IPOPT_LSRR'
 #define IPOPT_LSRR              131             /* loose source route */
                                 ^~~
 netcat.c:800:38: warning: too few arguments in call to 'bail'
       bail ("UDP listen needs -p arg");
       ~~~~                           ^
 netcat.c:804:35: warning: too few arguments in call to 'bail'
       bail ("local listen fuxored");
       ~~~~                        ^
 netcat.c:818:46: warning: passing 'int *' to parameter of type 'socklen_t
 *' (aka 'unsigned int *') converts between pointers to integer types with
 different sign [-Wpointer-sign]
     rr = getsockname (nnetfd, (SA *) lclend, &x);
                                              ^~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/socket.h:706:78:
 note: passing argument to parameter here
 int     getsockname(int, struct sockaddr * __restrict, socklen_t *
 __restrict)
 ^
 netcat.c:820:41: warning: too few arguments in call to 'holler'
       holler ("local getsockname failed");
       ~~~~~~                            ^
 netcat.c:828:26: warning: too few arguments in call to 'holler'
     holler (bigbuf_net, z);
     ~~~~~~               ^
 netcat.c:828:25: warning: incompatible integer to pointer conversion
 passing 'unsigned short' to parameter of type 'char *' [-Wint-conversion]
     holler (bigbuf_net, z);
                         ^
 netcat.c:841:56: warning: passing 'int *' to parameter of type 'socklen_t
 *' (aka 'unsigned int *') converts between pointers to integer types with
 different sign [-Wpointer-sign]
         (nnetfd, bigbuf_net, BIGSIZ, MSG_PEEK, (SA *) remend, &x);
                                                               ^~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/socket.h:712:27:
 note: passing argument to parameter here
     socklen_t * __restrict) __DARWIN_ALIAS_C(recvfrom);
                           ^
 netcat.c:865:40: warning: passing 'int *' to parameter of type 'socklen_t
 *' (aka 'unsigned int *') converts between pointers to integer types with
 different sign [-Wpointer-sign]
     rr = accept (nnetfd, (SA *)remend, &x);
                                        ^~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/socket.h:700:73:
 note: passing argument to parameter here
 int     accept(int, struct sockaddr * __restrict, socklen_t * __restrict)
                                                                         ^
 netcat.c:869:3: error: implicit declaration of function 'close' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
   close (nnetfd);               /* dump the old socket */
   ^
 netcat.c:886:60: warning: passing 'int *' to parameter of type 'socklen_t
 *' (aka 'unsigned int *') converts between pointers to integer types with
 different sign [-Wpointer-sign]
   rr = getsockopt (nnetfd, IPPROTO_IP, IP_OPTIONS, optbuf, &x);
                                                            ^~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/socket.h:708:76:
 note: passing argument to parameter here
 int     getsockopt(int, int, int, void * __restrict, socklen_t *
 __restrict);
 ^
 netcat.c:888:32: warning: too few arguments in call to 'holler'
     holler ("getsockopt failed");
     ~~~~~~                     ^
 netcat.c:901:41: warning: too few arguments in call to 'holler'
     holler ("IP options: %s", bigbuf_net);
     ~~~~~~                              ^
 netcat.c:913:44: warning: passing 'int *' to parameter of type 'socklen_t
 *' (aka 'unsigned int *') converts between pointers to integer types with
 different sign [-Wpointer-sign]
   rr = getsockname (nnetfd, (SA *) lclend, &x);
                                            ^~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/socket.h:706:78:
 note: passing argument to parameter here
 int     getsockname(int, struct sockaddr * __restrict, socklen_t *
 __restrict)
 ^
 netcat.c:915:42: warning: too few arguments in call to 'holler'
     holler ("post-rcv getsockname failed");
     ~~~~~~                               ^
 netcat.c:940:39: warning: too few arguments in call to 'bail'
         cp, whozis->name, whozis->addrs[0], z);
                                              ^
 netcat.c:940:38: warning: incompatible integer to pointer conversion
 passing 'unsigned short' to parameter of type 'char *' [-Wint-conversion]
         cp, whozis->name, whozis->addrs[0], z);
                                             ^
 netcat.c:942:39: warning: too few arguments in call to 'holler'
         cp, whozis->name, whozis->addrs[0], z);
                                              ^
 netcat.c:942:38: warning: incompatible integer to pointer conversion
 passing 'unsigned short' to parameter of type 'char *' [-Wint-conversion]
         cp, whozis->name, whozis->addrs[0], z);
                                             ^
 netcat.c:962:1: warning: type specifier missing, defaults to 'int'
 [-Wimplicit-int]
 udptest (fd, where)
 ^
 netcat.c:968:8: error: implicit declaration of function 'write' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
   rr = write (fd, bigbuf_in, 1);
        ^
 netcat.c:968:8: note: did you mean 'fwrite'?
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/stdio.h:165:9:
 note: 'fwrite' declared here
 size_t   fwrite(const void * __restrict __ptr, size_t __size, size_t
 __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite);
          ^
 netcat.c:970:59: warning: too few arguments in call to 'holler'
     holler ("udptest first write failed?! errno %d", errno);
     ~~~~~~                                                ^
 netcat.c:970:54: warning: incompatible integer to pointer conversion
 passing 'int' to parameter of type 'char *' [-Wint-conversion]
     holler ("udptest first write failed?! errno %d", errno);
                                                      ^~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/errno.h:81:15:
 note: expanded from macro 'errno'
 #define errno (*__error())
               ^~~~~~~~~~~~
 netcat.c:972:5: error: implicit declaration of function 'sleep' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
     sleep (o_wait);
     ^
 netcat.c:983:7: error: implicit declaration of function 'close' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
       close (rr);                       /* in case it *did* open */
       ^
 netcat.c:991:3: error: implicit declaration of function 'close' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
   close (fd);                           /* use it or lose it! */
   ^
 netcat.c:1020:44: warning: too few arguments in call to 'bail'
     bail ("oprint called with no open fd?!");
     ~~~~                                   ^
 netcat.c:1057:14: warning: passing 'unsigned char *' to parameter of type
 'char *' converts between pointers to integer types with different sign
 [-Wpointer-sign]
     sprintf (&stage[2], "%8.8x ", obc);         /* xxx: still slow? */
              ^~~~~~~~~
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/secure/_stdio.h:47:28:
 note: expanded from macro 'sprintf'
   __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                            ^~~
 netcat.c:1080:9: error: implicit declaration of function 'write' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
     x = write (ofd, stage, soc);
         ^
 netcat.c:1082:28: warning: too few arguments in call to 'bail'
       bail ("ofd write err");
       ~~~~                 ^
 netcat.c:1147:43: warning: too few arguments in call to 'holler'
     holler ("Preposterous fd value %d", fd);
     ~~~~~~                                ^
 netcat.c:1147:41: warning: incompatible integer to pointer conversion
 passing 'int' to parameter of type 'char *' [-Wint-conversion]
     holler ("Preposterous fd value %d", fd);
                                         ^~
 netcat.c:1162:7: error: implicit declaration of function 'close' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
       close (0);                /* so we won't need any more stdin */
       ^
 netcat.c:1166:5: error: implicit declaration of function 'sleep' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
     sleep (o_interval);         /* pause *before* sending stuff, too */
     ^
 netcat.c:1184:28: warning: too few arguments in call to 'holler'
           holler ("select fuxored");
           ~~~~~~                  ^
 netcat.c:1185:4: error: implicit declaration of function 'close' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
           close (fd);
           ^
 netcat.c:1196:27: warning: too few arguments in call to 'holler'
             holler ("net timeout");
             ~~~~~~               ^
 netcat.c:1197:4: error: implicit declaration of function 'close' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
           close (fd);
           ^
 netcat.c:1207:7: error: implicit declaration of function 'farm9crypt_read'
 is invalid in C99 [-Werror,-Wimplicit-function-declaration]
         rr = farm9crypt_read (fd, bigbuf_net, BIGSIZ);
              ^
 netcat.c:1229:7: error: implicit declaration of function 'read' is invalid
 in C99 [-Werror,-Wimplicit-function-declaration]
         rr = read (0, bigbuf_in, BIGSIZ);
              ^
 netcat.c:1229:7: note: did you mean 'fread'?
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/stdio.h:158:9:
 note: 'fread' declared here
 size_t   fread(void * __restrict __ptr, size_t __size, size_t __nitems,
 FILE * __restrict __stream);
          ^
 fatal error: too many errors emitted, stopping now [-ferror-limit=]
 61 warnings and 20 errors generated.
 make[1]: *** [netcat.o] Error 1
 make[1]: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_cryptcat/cryptcat/work/unix'
 make: *** [darwin] Error 2
 make: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_cryptcat/cryptcat/work/unix'
 Command failed:  cd
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_cryptcat/cryptcat/work/unix"
 && /usr/bin/make -j16 -w darwin
 Exit code: 2
 Error: Failed to build cryptcat: command execution failed
 DEBUG: Error code: CHILDSTATUS 6233 2
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/63124>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list