mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
Fixed -r, -R to named pipe "No such device or address" error
This commit is contained in:
parent
1a1cbb1598
commit
2fe44bbd78
2 changed files with 25 additions and 2 deletions
5
CHANGES
5
CHANGES
|
@ -40,6 +40,11 @@ Corrections:
|
||||||
Test: SNIFF_RIGHT_TO_LEFT
|
Test: SNIFF_RIGHT_TO_LEFT
|
||||||
Thanks to 1314 gsf for reporting this bug and sending a patch.
|
Thanks to 1314 gsf for reporting this bug and sending a patch.
|
||||||
|
|
||||||
|
Options -r and -R, when opening a named pipe that has no actual reader,
|
||||||
|
failed with "No such device or address". To solve this problem, Socat
|
||||||
|
now opens the pipe in rw-Mode.
|
||||||
|
Thanks to Cody J.Soultz for sending a patch.
|
||||||
|
|
||||||
Testing:
|
Testing:
|
||||||
Prevent the TIMESTAMP tests from sporadically failing due do seconds
|
Prevent the TIMESTAMP tests from sporadically failing due do seconds
|
||||||
overflow
|
overflow
|
||||||
|
|
22
socat.c
22
socat.c
|
@ -191,8 +191,17 @@ int main(int argc, const char *argv[]) {
|
||||||
#ifdef O_LARGEFILE
|
#ifdef O_LARGEFILE
|
||||||
O_LARGEFILE|
|
O_LARGEFILE|
|
||||||
#endif
|
#endif
|
||||||
O_NONBLOCK, 0664)) < 0)
|
O_NONBLOCK, 0664)) < 0) {
|
||||||
|
if (errno == ENXIO) {
|
||||||
|
if ((socat_opts.sniffleft = Open(a, O_CREAT|O_RDWR|O_APPEND|
|
||||||
|
#ifdef O_LARGEFILE
|
||||||
|
O_LARGEFILE|
|
||||||
|
#endif
|
||||||
|
O_NONBLOCK, 0664)) > 0)
|
||||||
|
break; /* try to open pipe rdwr */
|
||||||
|
}
|
||||||
Error2("option -r \"%s\": %s", a, strerror(errno));
|
Error2("option -r \"%s\": %s", a, strerror(errno));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'R': if (arg1[0][2]) {
|
case 'R': if (arg1[0][2]) {
|
||||||
a = *arg1+2;
|
a = *arg1+2;
|
||||||
|
@ -207,8 +216,17 @@ int main(int argc, const char *argv[]) {
|
||||||
#ifdef O_LARGEFILE
|
#ifdef O_LARGEFILE
|
||||||
O_LARGEFILE|
|
O_LARGEFILE|
|
||||||
#endif
|
#endif
|
||||||
O_NONBLOCK, 0664)) < 0)
|
O_NONBLOCK, 0664)) < 0) {
|
||||||
|
if (errno == ENXIO) {
|
||||||
|
if ((socat_opts.sniffright = Open(a, O_CREAT|O_RDWR|O_APPEND|
|
||||||
|
#ifdef O_LARGEFILE
|
||||||
|
O_LARGEFILE|
|
||||||
|
#endif
|
||||||
|
O_NONBLOCK, 0664)) > 0)
|
||||||
|
break; /* try to open pipe rdwr */
|
||||||
|
}
|
||||||
Error2("option -R \"%s\": %s", a, strerror(errno));
|
Error2("option -R \"%s\": %s", a, strerror(errno));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'b': if (arg1[0][2]) {
|
case 'b': if (arg1[0][2]) {
|
||||||
a = *arg1+2;
|
a = *arg1+2;
|
||||||
|
|
Loading…
Reference in a new issue