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