BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006024 [uClibc] Other minor always 11-07-08 14:53 11-09-08 05:13
Reporter michael_d View Status public  
Assigned To uClibc
Priority normal Resolution fixed  
Status closed   Product Version 0.9.30
Summary 0006024: openpty() doesn't support old pseudoterminals
Description The openpty() function in libutil fails to work with old style pseudoterminals (/dev/ttypXX and /dev/ptypXX). This is because it now uses the new posix_openpt() function, which presently only tries to use new style psedoterminals (/dev/ptmx).

I've created a patch to fix this. It moves the call to the fallback old terminal routines to within posix_openpt(), instead of directly from the getpt() wrapper function.

This patch only handles the case where the open flags supplied to posix_openpt() are O_RDWR. It would be straightforward to implement posix_openpt() with other flags for old terminals, but would make the patch much more complicated. This patch is simple and suffices to eliminate the regression from 0.9.29.
Additional Information
Attached Files  uClibc-0.9.30-rc3-openptfix.diff [^] (645 bytes) 11-07-08 14:53

- Relationships

- Notes
(0015264)
bernhardf
11-07-08 16:05

I'll think about removing the fallback from posix_openpt some more..
Other than that, i'd suggest:
Index: libc/stdlib/getpt.c
===================================================================
--- libc/stdlib/getpt.c (revision 23964)
+++ libc/stdlib/getpt.c (working copy)
@@ -108,6 +108,11 @@ posix_openpt (int flags)
         return -1;
     }
     }
+#if !defined __UNIX98PTY_ONLY__ && defined __UCLIBC_HAS_GETPT__
+ /* If we have no ptmx then ignore flags and use the fallback. */
+ if (_state & have_no_dev_ptmx)
+ return __bsd_getpt();
+#endif
   return -1;
 }
 libc_hidden_def(posix_openpt)
@@ -126,7 +131,7 @@ getpt (void)
     return fd;
 }
 
-#if !defined __UNIX98PTY_ONLY__
+#if !defined __UNIX98PTY_ONLY__ && defined __UCLIBC_HAS_GETPT__
 # define PTYNAME1 "pqrstuvwxyzabcde";
 # define PTYNAME2 "0123456789abcdef";
 


Thanks for the heads-up!
 
(0015294)
bernhardf
11-09-08 05:13

This should be fixed in r23974. Thanks!
 

- Issue History
Date Modified Username Field Change
11-07-08 14:53 michael_d New Issue
11-07-08 14:53 michael_d Status new => assigned
11-07-08 14:53 michael_d Assigned To  => uClibc
11-07-08 14:53 michael_d File Added: uClibc-0.9.30-rc3-openptfix.diff
11-07-08 16:05 bernhardf Note Added: 0015264
11-09-08 05:13 bernhardf Status assigned => closed
11-09-08 05:13 bernhardf Note Added: 0015294
11-09-08 05:13 bernhardf Resolution open => fixed
11-09-08 05:13 bernhardf Fixed in Version  => 0.9.30


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker