# define CMSG_LEN(len) (sizeof (cmsghdr) + len)
#endif
-int
+bool
ptytty::send_fd (int socket, int fd)
{
msghdr msg;
msg.msg_controllen = cmsg->cmsg_len;
- return sendmsg (socket, &msg, 0);
+ return sendmsg (socket, &msg, 0) >= 0;
}
int
static void drop_privileges ();
static void use_helper ();
- static int send_fd (int socket, int fd);
+ static bool send_fd (int socket, int fd);
static int recv_fd (int socket);
protected:
fprintf (stderr, "%s", (const char *)tok);
else if (!strcmp (tok, "GETFD") && c.recv (cint))
{
- if (ptytty::send_fd (c.fd, cint) < 0)
+ if (!ptytty::send_fd (c.fd, cint))
{
fprintf (stderr, "unable to send fd %d: ", cint); perror (0);
exit (EXIT_FAILURE);