Ich erinner mich noch, das ich die ptym_open() funktion als komisch
empfand da es iirc zumindest unter bsd einen "simplereren" weg gaebe an
ein freies [pt]ty Paar zu kommen:
int
ptym_open (char *pts_name)
{
int fd;
[...]
#else /* !SYSV */
char *pos1, *pos2;
strcpy (pts_name, "/dev/ptyXY");
for (pos1 = "pqrstuvwxyzPQRST"; *pos1 != '\0'; pos1++)
{
pts_name[8] = *pos1;
for (pos2 = "0123456789abcdef"; *pos2 != '\0'; pos2++)
{
pts_name[9] = *pos2;
if ((fd = open (pts_name, O_RDWR)) < 0)
continue;
pts_name[5] = 't';
return (fd);
}
}
return (-1);
#endif
[...]
}
Ich hatte damals mit folgendem Codeblock aus der sshv2.c von gftp
"rumgespielt" aber hab es auch nicht zum laufen bekommen.
exepath = g_strdup_printf ("echo -n xsftp ; %s%csftp-server", p1, p2);
args = make_ssh_exec_args (request, exepath, sshv2_use_sftp_subsys,
port);
if (ssh_use_askpass || sshv2_use_sftp_subsys)
{
fdm = fds = 0;
if (socketpair (AF_LOCAL, SOCK_STREAM, 0, s) < 0)
{
request->logging_function (gftp_logging_error,
request->user_data,
_("Cannot create a socket pair:
%s\n"),
g_strerror (errno));
return (-2);
}
}
else
{
s[0] = s[1] = 0;
if ((fdm = ptym_open (pts_name)) < 0)
{
request->logging_function (gftp_logging_error,
request->user_data,
_("Cannot open master pty %s: %s\n"),
pts_name,
g_strerror (errno));
return (-2);
}
}
if ((child = fork ()) == 0)
{
setsid ();
if (ssh_use_askpass || sshv2_use_sftp_subsys)
{
close (s[0]);
fds = s[1];
}
else
{
if ((fds = ptys_open (fdm, pts_name)) < 0)
{
printf ("Cannot open slave pts %s: %s\n", pts_name,
g_strerror (errno));
return (-1);
}
close (fdm);
}
tty_raw (fds);
usw usf...
-- Oliver Lehmann @home: lehmann(at)ans-netz.de @office: oliver.lehmann(at)mgi.de @www: http://www.pofo.de/ | http://wishlist.ans-netz.de/ To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org with "unsubscribe de-bsd-questions" in the body of the messageReceived on Wed 23 Apr 2003 - 12:05:22 CEST