mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/pty/pty.c (get_device_once): FreeBSD 8 supported O_CLOEXEC flag
for posix_openpt, but FreeBSD 9's posix_openpt doesn't support O_CLOEXEC and fails if specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									53881a8c6d
								
							
						
					
					
						commit
						452bf3b9c9
					
				
					 2 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
					@ -6,8 +6,9 @@ Tue Nov  8 14:50:55 2011  NAKAMURA Usaku  <usa@ruby-lang.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Nov  8 11:01:04 2011  NARUSE, Yui  <naruse@ruby-lang.org>
 | 
					Tue Nov  8 11:01:04 2011  NARUSE, Yui  <naruse@ruby-lang.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* ext/pty/pty.c (get_device_once): FreeBSD's posix_openpt doesn't
 | 
						* ext/pty/pty.c (get_device_once): FreeBSD 8 supported O_CLOEXEC flag
 | 
				
			||||||
	  support O_CLOEXEC and fails if specified.
 | 
						  for posix_openpt, but FreeBSD 9's posix_openpt doesn't support
 | 
				
			||||||
 | 
						  O_CLOEXEC and fails if specified.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Nov  8 02:36:45 2011  NAKAMURA Usaku  <usa@ruby-lang.org>
 | 
					Tue Nov  8 02:36:45 2011  NAKAMURA Usaku  <usa@ruby-lang.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -291,19 +291,19 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
 | 
				
			||||||
    dfl.sa_flags = 0;
 | 
					    dfl.sa_flags = 0;
 | 
				
			||||||
    sigemptyset(&dfl.sa_mask);
 | 
					    sigemptyset(&dfl.sa_mask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__sun)
 | 
					#if defined(__sun) || defined(__FreeBSD__)
 | 
				
			||||||
    /* workaround for Solaris 10: grantpt() doesn't work if FD_CLOEXEC is set.  [ruby-dev:44688] */
 | 
					    /* workaround for Solaris 10: grantpt() doesn't work if FD_CLOEXEC is set.  [ruby-dev:44688] */
 | 
				
			||||||
 | 
					    /* FreeBSD 8 supported O_CLOEXEC for posix_openpt, but FreeBSD 9 removed it */
 | 
				
			||||||
    if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error;
 | 
					    if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error;
 | 
				
			||||||
    if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
 | 
					    if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
 | 
				
			||||||
    if (grantpt(masterfd) == -1) goto grantpt_error;
 | 
					    if (grantpt(masterfd) == -1) goto grantpt_error;
 | 
				
			||||||
    rb_fd_fix_cloexec(masterfd);
 | 
					    rb_fd_fix_cloexec(masterfd);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    flags = O_RDWR|O_NOCTTY;
 | 
					    flags = O_RDWR|O_NOCTTY;
 | 
				
			||||||
# if defined(O_CLOEXEC) && !defined(__FreeBSD__)
 | 
					# if defined(O_CLOEXEC)
 | 
				
			||||||
    /* glibc posix_openpt() in GNU/Linux calls open("/dev/ptmx", flags) internally.
 | 
					    /* glibc posix_openpt() in GNU/Linux calls open("/dev/ptmx", flags) internally.
 | 
				
			||||||
     * So version dependency on GNU/Linux is same as O_CLOEXEC with open().
 | 
					     * So version dependency on GNU/Linux is same as O_CLOEXEC with open().
 | 
				
			||||||
     * O_CLOEXEC is available since Linux 2.6.23.  Linux 2.6.18 silently ignore it.
 | 
					     * O_CLOEXEC is available since Linux 2.6.23.  Linux 2.6.18 silently ignore it. */
 | 
				
			||||||
     * FreeBSD's posix_openpt doesn't support O_CLOEXEC and fails if specified*/
 | 
					 | 
				
			||||||
    flags |= O_CLOEXEC;
 | 
					    flags |= O_CLOEXEC;
 | 
				
			||||||
# endif
 | 
					# endif
 | 
				
			||||||
    if ((masterfd = posix_openpt(flags)) == -1) goto error;
 | 
					    if ((masterfd = posix_openpt(flags)) == -1) goto error;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue