@@ -286,8 +286,8 @@ ptsname_r(int fd, char *buf, size_t buflen)
286286#endif
287287
288288#if defined(HAVE_POSIX_OPENPT ) || defined(HAVE_OPENPTY ) || defined(HAVE_PTSNAME_R )
289- static int
290- set_device_mode (const char * slavedevice , int fd , int nomesg )
289+ static inline int
290+ prevent_messages (const char * slavedevice , int fd , int nomesg )
291291{
292292 if (nomesg )
293293 return change_mode (slavedevice , fd , 0600 );
@@ -352,7 +352,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
352352 if (ptsname_r (masterfd , SlaveName , DEVICELEN ) != 0 ) goto error ;
353353 slavedevice = SlaveName ;
354354 if ((slavefd = rb_cloexec_open (slavedevice , O_RDWR |O_NOCTTY , 0 )) == -1 ) goto error ;
355- if (set_device_mode (slavedevice , slavefd , nomesg ) == -1 ) goto error ;
355+ if (prevent_messages (slavedevice , slavefd , nomesg ) == -1 ) goto error ;
356356 rb_update_max_fd (slavefd );
357357
358358#if defined(I_PUSH ) && !defined(__linux__ ) && !defined(_AIX )
@@ -386,7 +386,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
386386 }
387387 rb_fd_fix_cloexec (* master );
388388 rb_fd_fix_cloexec (* slave );
389- if (set_device_mode (SlaveName , * slave , nomesg ) == -1 ) {
389+ if (prevent_messages (SlaveName , * slave , nomesg ) == -1 ) {
390390 close (* master );
391391 close (* slave );
392392 if (!fail ) return -1 ;
@@ -438,7 +438,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
438438 if (ptsname_r (masterfd , SlaveName , DEVICELEN ) != 0 ) goto error ;
439439 slavedevice = SlaveName ;
440440 if ((slavefd = rb_cloexec_open (slavedevice , O_RDWR , 0 )) == -1 ) goto error ;
441- if (set_device_mode (slavedevice , slavefd , nomesg ) == -1 ) goto error ;
441+ if (prevent_messages (slavedevice , slavefd , nomesg ) == -1 ) goto error ;
442442 rb_update_max_fd (slavefd );
443443#if defined(I_PUSH ) && !defined(__linux__ ) && !defined(_AIX )
444444 if (ioctl_I_PUSH (slavefd , "ptem" ) == -1 ) goto error ;
0 commit comments