View Single Post
Old 09-08-2013, 06:19 PM   #21
jtt
Connoisseur
jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.jtt can successfully navigate the Paris bus system.
 
Posts: 95
Karma: 36996
Join Date: Aug 2013
Location: Berlin, Germany
Device: PB 622, PB 623
Quote:
Originally Posted by rkomar View Post
It's hard to tell with the remote debugging, but it looks like the segfault occurs during the read() because m_pty_fd = -1. I think the function should probably check the file descriptor value first, but in the end, without the pty working properly, nothing correct is ever going to happen anyway, so maybe getting a segfault at that point isn't any worse than just failing gracefully.
Sounds impossible - read() has no business of segfaulting on a bad file descriptor at all, in that case it's supposed to return -1 and set 'errno' to EBADF - if this can't be relied on then there's a lot more to worry about on this platform than I'd ever have imagined:-(

But then I'm also surprised that you get to the get_shell_output() function if 'm_pty_fd' is negative - that's checked when the PTY is opened and on failure (or other problems) CloseApp() is called. Looks like my assumption that, like exit(), it would terminate the program immmediately, is wrong. I'll put something in that avoids this situation. Thanks for making me aware of this possibility!

Best regards, Jens

PS: The modified version is now available for download.

Last edited by jtt; 09-08-2013 at 06:30 PM.
jtt is offline   Reply With Quote