it a useful default. 0 isn't valid on all operating systems - on
Solaris (at least) TCSANOW, TCSADRAIN and TCSAFLUSH have the same
values as the equivalent ioctls, TCSETS, TCSETSW and TCSETSF. */
- RETVAL = tcsetattr(fd, optional_actions, termios_ref);
+ if (optional_actions < 0) {
+ SETERRNO(EINVAL, LIB_INVARG);
+ RETVAL = -1;
+ } else {
+ RETVAL = tcsetattr(fd, optional_actions, termios_ref);
+ }
} else {
SETERRNO(EBADF,RMS_IFI);
RETVAL = -1;