LinHES Forums
http://forums.linhes.org/

grantpt(3) library function fails (R5E50)
http://forums.linhes.org/viewtopic.php?f=6&t=14687
Page 1 of 1

Author:  Hugh [ Sun Mar 25, 2007 12:51 pm ]
Post subject:  grantpt(3) library function fails (R5E50)

This is quite obscure. The following test program fails on my KnoppMyth R5E50 installation. It works on Debian sid, Fedora Core 6, and Ubuntu 6.06. It is an extract from a program that has worked on many systems for 15 years.

Any idea why it would fail? I think that this is a KnoppMyth bug.

The failure message is:
Code:
could not grantpt: 2 No such file or directory

An strace of the code shows:
Code:
stat64("/dev/pts/0", 0xbfec3cb4)        = -1 ENOENT (No such file or directory)

Here is the C test program:
Code:
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>

int
main(int argc, char **argv)
{
    int ptyfd = open("/dev/ptmx", O_RDWR);

    if (ptyfd < 0) {
        printf("could not open /dev/ptmx: %d %s\n", errno, strerror(errno));
    } else if (grantpt(ptyfd) <0) {
        printf("could not grantpt: %d %s\n", errno, strerror(errno));
    } else {
        printf("success\n");
    }
}

Author:  tjc [ Sun Mar 25, 2007 3:05 pm ]
Post subject: 

Most likely due to a change in the 2.6 kernel. http://www.ussg.iu.edu/hypermail/linux/kernel/0311.2/0502.html

Author:  Hugh [ Sun Mar 25, 2007 5:00 pm ]
Post subject: 

tjc wrote:
Most likely due to a change in the 2.6 kernel. http://www.ussg.iu.edu/hypermail/linux/kernel/0311.2/0502.html
Well spotted.

On my KnoppMyth, mount does not report /dev as a mount point. It is neither in mtab nor in fstab. Its inode number is neither 1 nor 2. But it sure seems to be mounted. I can get grantpt working by issuing the following command:
Code:
mount -t devpts devpts /dev/pts

Does this mean that there are two bugs?
    (1) not mounting /dev/pts at the right time, and
    (2) mounting /dev in a way that confuses mount.

Author:  tjc [ Sun Mar 25, 2007 9:57 pm ]
Post subject: 

Why don't you just add that entry to /etc/fstab?

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/