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