[uClibc]Bug in 0.9.15 ptsname()?

Bruce J.A. Nourish kode187 at kode187.net
Fri Nov 1 04:46:53 UTC 2002


I think there's a bug in ptsname(). I ran into it because rxvt kept
bombing with "can't open slave tty" errors on my target and build
systems. It seems to return null on perfectly good pty file descriptors.
The following code works fine under the Globulous Libc, but fails under
uClibc.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>

extern char *ptsname();

int main(int argc, char **argv) {
        int fd, grantpt_res, unlockpt_res;

        char *myptname;


        fd = getpt();
        assert(fd >= 0);

        grantpt_res = grantpt(fd);
        assert(grantpt_res == 0);

        unlockpt_res = unlockpt(fd);
        assert(unlockpt_res == 0);

        /* should be okay up to here */

        myptname = ptsname(fd);
        assert(myptname != NULL);

        return 0;
}
                
-- 
Bruce J.A. Nourish <kode187 at kode187.net>



More information about the uClibc mailing list