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 = posix_openpt (O_RDWR | O_NOCTTY); if (fd < 0) { printf("Failed to open PTY: %s\n", strerror(errno)); return -1; } else { if ((p = ptsname(fd)) != NULL) { printf("ptsname = %s\n", p); } else { printf("Failed to get ptsname: %s\n", strerror(errno)); 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 -- Joe Marcus Clarke FreeBSD GNOME Team :: gnome_at_FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:38 UTC