-CURRENT and ptsname() again

From: Vladimir Kushnir <vkushnir_at_i.kiev.ua>
Date: Mon, 11 Apr 2005 01:09:13 +0300 (EEST)
Hello,
It definitely looks like posix_openpt (perhaps) and ptsname/grantpt 
(most probably) do not work as they should under -CURRENT. Examples:  mc 
(misc/mc) reports:

subshell.c: couldn't open master side of pty
pty_open_master: Permission denied

KDE (at least CVS, but it's pty handling did not change recently) 
complaints about chown

The simplest example:

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

main() {
 	int pty_master;
 	char *master_name, *slave_name;
 	struct stat sb;

 	pty_master = posix_openpt(O_RDWR | O_NOCTTY);
 	fstat(pty_master, &sb);
         if (grantpt (pty_master) < 0) {
 		printf("Fail: grantpt\n");
 	}
 	if (unlockpt (pty_master) < 0) {
 		printf("Fail: unlocktpt\n");
 	}
 	master_name = devname(sb.st_rdev, S_IFCHR);
 	slave_name = ptsname (pty_master);

 	printf("Open master: /dev/%s, slave: %s\n", master_name, slave_name);
 	close (pty_master);
 	return 0;
}

gives an absurd output:

~> ./ptytest
Fail: grantpt
Open master: /dev/ptyp0, slave: /dev/ttysu
                                 ^^^^^^^^^^
grantpt() here also fails.

This is fairly recent -CURRENT:
FreeBSD kushnir1.kiev.ua 6.0-CURRENT FreeBSD 6.0-CURRENT #6: Sat Apr  9 
23:17:34 EEST 2005     root_at_:/usr/obj/usr/src/sys/KUSHNIR  i386

Sorry, cannot fix it myself
Redards,
Vladimir
Received on Sun Apr 10 2005 - 20:09:19 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:31 UTC