mirror of
https://repo.or.cz/socat.git
synced 2024-12-23 07:52:32 +00:00
The call "socat -r - PIPE" traced to file ./- instead of issuing a syntax error
This commit is contained in:
parent
2fe44bbd78
commit
39e24c2b06
2 changed files with 12 additions and 7 deletions
3
CHANGES
3
CHANGES
|
@ -45,6 +45,9 @@ Corrections:
|
||||||
now opens the pipe in rw-Mode.
|
now opens the pipe in rw-Mode.
|
||||||
Thanks to Cody J.Soultz for sending a patch.
|
Thanks to Cody J.Soultz for sending a patch.
|
||||||
|
|
||||||
|
The call "socat -r - PIPE" traced to file ./- instead of issuing a
|
||||||
|
syntax error.
|
||||||
|
|
||||||
Testing:
|
Testing:
|
||||||
Prevent the TIMESTAMP tests from sporadically failing due do seconds
|
Prevent the TIMESTAMP tests from sporadically failing due do seconds
|
||||||
overflow
|
overflow
|
||||||
|
|
16
socat.c
16
socat.c
|
@ -92,6 +92,7 @@ int main(int argc, const char *argv[]) {
|
||||||
char buff[10];
|
char buff[10];
|
||||||
double rto;
|
double rto;
|
||||||
int i, argc0, result;
|
int i, argc0, result;
|
||||||
|
bool isdash = false;
|
||||||
struct utsname ubuf;
|
struct utsname ubuf;
|
||||||
int lockrc;
|
int lockrc;
|
||||||
|
|
||||||
|
@ -316,21 +317,22 @@ int main(int argc, const char *argv[]) {
|
||||||
#endif /* WITH_IP4 || WITH_IP6 */
|
#endif /* WITH_IP4 || WITH_IP6 */
|
||||||
case '\0':
|
case '\0':
|
||||||
case ',':
|
case ',':
|
||||||
case ':': break; /* this "-" is a variation of STDIO */
|
case ':':
|
||||||
|
isdash = true;
|
||||||
|
break; /* this "-" is a variation of STDIO */
|
||||||
default:
|
default:
|
||||||
xioinqopt('p', buff, sizeof(buff));
|
xioinqopt('p', buff, sizeof(buff)); /* fetch pipe separator char */
|
||||||
if (arg1[0][1] == buff[0]) {
|
if (arg1[0][1] == buff[0]) {
|
||||||
|
isdash = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Error1("unknown option \"%s\"; use option \"-h\" for help", arg1[0]);
|
Error1("unknown option \"%s\"; use option \"-h\" for help", arg1[0]);
|
||||||
Exit(1);
|
Exit(1);
|
||||||
}
|
}
|
||||||
/* the leading "-" might be a form of the first address */
|
if (isdash) {
|
||||||
xioinqopt('p', buff, sizeof(buff));
|
/* the leading "-" is a form of the first address */
|
||||||
if (arg1[0][0] == '-' &&
|
|
||||||
(arg1[0][1] == '\0' || arg1[0][1] == ':' ||
|
|
||||||
arg1[0][1] == ',' || arg1[0][1] == buff[0]))
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
++arg1; --argc;
|
++arg1; --argc;
|
||||||
}
|
}
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
|
|
Loading…
Reference in a new issue