getpt() opens a pseudoterminal master always returns 0
Issue
We use getpt ()
to open the pseudo terminal master. In one of our applications this always returns 0.
Strace traces also showed the same:
open("/dev/ptmx", O_RDWR) = 0
Code snippet:
fd = getpt (); // open the pseudo terminal master
if (fd >= 0) {
..
}
else {
return "Could not get pseudo terminal";
}
On the live system we are going into the else part. Please let me know why the api is returning 0.
Environment
- Red Hat Enterprise Linux
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.