[Libguestfs] [PATCH v2 4/9] daemon: Add -l / --listen flag.
Pino Toscano
ptoscano at redhat.com
Mon Jun 29 16:49:58 UTC 2015
In data giovedì 25 giugno 2015 15:56:56, Richard W.M. Jones ha scritto:
> This option, used for testing, causes the daemon to create the Unix
> domain socket (from guestfs_channel), listen on it, and accept a
> single connection.
> ---
> [...]
> + else {
> + struct sockaddr_un addr;
> +
> + sock = socket (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
> + if (sock == -1)
> + error (EXIT_FAILURE, errno, "socket");
> + addr.sun_family = AF_UNIX;
> + strncpy (addr.sun_path, channel, UNIX_PATH_MAX);
> + addr.sun_path[UNIX_PATH_MAX-1] = '\0';
As a safety measure, would be better to error() if strlen(channel) is
greater than UNIX_PATH_MAX-1 (avoid truncating the socket path passed).
Thanks,
--
Pino Toscano
More information about the Libguestfs
mailing list