Date: Tue, 05 Jul 2005 00:57:45 -0400 From: Joe Marcus Clarke <marcus@FreeBSD.org> To: current@FreeBSD.org Cc: phk@FreeBSD.org Subject: grantpt broken on -CURRENT Message-ID: <1120539465.3587.19.camel@shumai.marcuscom.com>
next in thread | raw e-mail | index | archive | help
--=-8vO5n1Ap6o9rCDn0XvOp
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
I recently discovered the gnome-vfs sftp method which uses
posix_openpt/ptsname/grantpt to set up a pty for communicating with the
sftp subprocess fails to work. I found that grantpt() fails due to
EACCES. The underlying reason looks to be that the pty name returned by
ptsname() is not unhidden in devfs. Basically, the following code will
fail:
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
main(void) {
int fd;
char *p;
fd =3D posix_openpt (O_RDWR | O_NOCTTY);
if (fd < 0) {
printf("Failed to open PTY: %s\n", strerror(errno));
return -1;
}
else {
if ((p =3D ptsname(fd)) !=3D NULL) {
printf("ptsname =3D %s\n", p);
}
else {
printf("Failed to get ptsname: %s\n", strerror(errn=
o));
close (fd);
if (grantpt(fd) < 0) {
printf("Failed to run grantpt: %s\n", strerror(errno));
close (fd);
return -1;
}
close (fd);
return 0;
}
Basically, everything works until the grantpt() call which returns
EACCES. The same code works just fine under 5-STABLE. I even tried
manually applying devfs rules to unhide the missing tty device
(/dev/ttys5 in my tests), but that didn't work. The program also fails
in the same way when run as root.
This has been failing since I upgraded from 5-STABLE to -CURRENT about
three weeks ago. I'm now running -CURRENT from yesterday.
Joe
--=20
Joe Marcus Clarke
FreeBSD GNOME Team :: gnome@FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome
--=-8vO5n1Ap6o9rCDn0XvOp
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)
iD8DBQBCyhNJb2iPiv4Uz4cRAtvTAKCS2EG5cRgdm8n4SkzucedAnYM6mwCcDCtR
75FDZ8CMOInJqvgN3v8LeHw=
=8cnj
-----END PGP SIGNATURE-----
--=-8vO5n1Ap6o9rCDn0XvOp--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1120539465.3587.19.camel>
