Operating System - HP-UX
1833876 Members
1683 Online
110063 Solutions
New Discussion

Re: /dev/tty and getpass()

 
JUP
Regular Advisor

/dev/tty and getpass()

Hi

I have a C program that calls getpass() on a HP-UX 11.0 system. However getpass fails because it has a problem reading /dev/tty. However my permissions on /dev/tty are as follows:

crw-rw-rw- 1 bin bin 207 0x000000 Jul 1 13:28 /dev/tty

The program works on another HP-UX 11 box with the same permissions as the above.

Any help would be much appreciated ?

Thanks in advance
JUP
3 REPLIES 3
Muthukumar_5
Honored Contributor

Re: /dev/tty and getpass()

Hai,

Did you try it with a simple program to check the getpass() call.

I have tried it on 11.23 as,

/* test.c */
#include
main() {
const char *prompt="/dev/tty";
if ( getpass(prompt) == NULL ) {
printf ("Error in reading problem\n");
exit (1);
}
exit (0);
}

It is prompting for /dev/tty. But there is needed to stop the program.

Use debugger and Check this on both machines.

Regards,
Muthukumar.
Easy to suggest when don't know about the problem!
JUP
Regular Advisor

Re: /dev/tty and getpass()

The getpass(0 routine fails. My guess is that /dev/tty has failed to open.

How can I test ?

Nicolas Dumeige
Esteemed Contributor

Re: /dev/tty and getpass()

Hello,

Dealing with the tty is getpass job, I think you don't even need to identify the tty or even mention it.

char *temp;
temp = (char *)getpass ("Password: ");

How do you use getpass and what is the exact error message ?

Nicolas
All different, all Unix