Commit Graph

3 Commits

Author SHA1 Message Date
Jonathan Wakely e6d1003543 libcody: Avoid double-free
If the listen call fails then 'goto fail' will jump to that label and
use freeaddrinfo again. Set the pointer to null to prevent that.

libcody/ChangeLog:

	* netserver.cc (ListenInet6): Set pointer to null after
	deallocation.
2021-10-21 22:23:00 +01:00
Gerald Pfeifer cf22f78ff6 libcody: Include <netinet/in.h> as needed
libcody as originally added to GCC fail to build on *-unknown-freebsd11.4
and presumably others:

  c++ -std=c++11 -g -include config.h -I ... -MMD -MP -MF netclient.d -c
    -o netclient.o
  .../libcody/netclient.cc:114:3: error: unknown type sockaddr_in6 addr;
                                                      ^~~~~~~~~~~~

sockaddr_in6 is declared in /usr/include/netinet6/in6.h,
which is included by /usr/include/netinet/in.h.

Indeed, per https://man7.org/linux/man-pages/man7/ipv6.7.html

    #include <sys/socket.h>
    #include <netinet/in.h>

should be included, and our own gcc/ada/gsocket.h also has

    #if !(defined (VMS) || defined (__MINGW32__))
    #include <sys/socket.h>
    #include <sys/un.h>
    #include <netinet/in.h>
    :
    #endif

libcody/ChangeLog:

2020-12-21  Gerald Pfeifer  <gerald@pfeifer.com>

	* netserver.cc: Include <netinet/in.h>.
2020-12-21 17:11:43 +01:00
Nathan Sidwell 362303298a Add libcody
In order to separate compiler from build system, C++ Modules, as
implemented in GCC introduces a communication channel between those
two entities.  This is implemented by libcody.  It is anticipated that
other implementations will also implement this protocol, or use
libcody to provide it.

	* Makefile.def: Add libcody.
	* configure.ac: Add libcody.
	* Makefile.in: Regenerated.
	* configure: Regenerated.
	gcc/
	* Makefile.in (CODYINC, CODYLIB, CODYLIB_H): New. Use them.
	libcody/
	* configure.ac: New.
	* CMakeLists.txt: New.
	* CODING.md: New.
	* CONTRIB.md: New.
	* LICENSE: New.
	* LICENSE.gcc: New.
	* Makefile.in: New.
	* Makesub.in: New.
	* README.md: New.
	* buffer.cc: New.
	* build-aux/config.guess: New.
	* build-aux/config.sub: New.
	* build-aux/install-sh: New.
	* client.cc: New.
	* cmake/libcody-config-ix.cmake
	* cody.hh: New.
	* config.h.in: New.
	* config.m4: New.
	* configure: New.
	* configure.ac: New.
	* dox.cfg.in: New.
	* fatal.cc: New.
	* gdbinit.in: New.
	* internal.hh: New.
	* netclient.cc: New.
	* netserver.cc: New.
	* packet.cc: New.
	* resolver.cc: New.
	* server.cc: New.
	* tests/01-serialize/connect.cc: New.
	* tests/01-serialize/decoder.cc: New.
	* tests/01-serialize/encoder.cc: New.
	* tests/02-comms/client-1.cc: New.
	* tests/02-comms/pivot-1.cc: New.
	* tests/02-comms/server-1.cc: New.
	* tests/Makesub.in: New.
	* tests/jouster: New.
2020-12-15 07:09:59 -08:00