1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-09 21:56:33 +00:00

Print error on useless fdout,fdin options

This commit is contained in:
Gerhard Rieger 2015-01-13 12:12:23 +01:00
parent 2b99929bfc
commit 8c8f817780
3 changed files with 49 additions and 2 deletions

View file

@ -103,8 +103,17 @@ int _xioopen_foxec(int xioflags, /* XIO_RDONLY etc. */
usepipes = false;
}
#endif /* HAVE_PTY */
retropt_ushort(popts, OPT_FDIN, (unsigned short *)&fdi);
retropt_ushort(popts, OPT_FDOUT, (unsigned short *)&fdo);
if (retropt_ushort(popts, OPT_FDIN, (unsigned short *)&fdi) >= 0) {
if ((xioflags&XIO_ACCMODE) == XIO_RDONLY) {
Error("_xioopen_foxec(): option fdin is useless in read-only mode");
}
}
if (retropt_ushort(popts, OPT_FDOUT, (unsigned short *)&fdo) >= 0) {
if ((xioflags&XIO_ACCMODE) == XIO_WRONLY) {
Error("_xioopen_foxec(): option fdout is useless in write-only mode");
}
}
if (withfork) {
if (!(xioflags&XIO_MAYCHILD)) {