|
Lines 333-361
Link Here
|
| 333 |
|
333 |
|
| 334 |
(void) signal(SIGPIPE, lostconn); |
334 |
(void) signal(SIGPIPE, lostconn); |
| 335 |
|
335 |
|
| 336 |
if ((targ = colon(argv[argc - 1]))) /* Dest is remote host. */ |
336 |
if ((targ = colon(argv[argc - 1]))) { /* Dest is remote host. */ |
| 337 |
toremote(targ, argc, argv); |
337 |
toremote(targ, argc, argv); |
| 338 |
else { |
338 |
/* |
|
|
339 |
* Finally check the exit status of the ssh process, if one was forked |
| 340 |
* and no error has occured yet |
| 341 |
*/ |
| 342 |
if (do_cmd_pid != -1 && errs == 0) { |
| 343 |
if (remin != -1) |
| 344 |
(void) close(remin); |
| 345 |
if (remout != -1) |
| 346 |
(void) close(remout); |
| 347 |
if (waitpid(do_cmd_pid, &status, 0) == -1) |
| 348 |
errs = 1; |
| 349 |
else { |
| 350 |
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) |
| 351 |
errs = 1; |
| 352 |
} |
| 353 |
} |
| 354 |
} else { |
| 339 |
tolocal(argc, argv); /* Dest is local host. */ |
355 |
tolocal(argc, argv); /* Dest is local host. */ |
| 340 |
if (targetshouldbedirectory) |
356 |
if (targetshouldbedirectory) |
| 341 |
verifydir(argv[argc - 1]); |
357 |
verifydir(argv[argc - 1]); |
| 342 |
} |
358 |
} |
| 343 |
/* |
|
|
| 344 |
* Finally check the exit status of the ssh process, if one was forked |
| 345 |
* and no error has occured yet |
| 346 |
*/ |
| 347 |
if (do_cmd_pid != -1 && errs == 0) { |
| 348 |
if (remin != -1) |
| 349 |
(void) close(remin); |
| 350 |
if (remout != -1) |
| 351 |
(void) close(remout); |
| 352 |
if (waitpid(do_cmd_pid, &status, 0) == -1) |
| 353 |
errs = 1; |
| 354 |
else { |
| 355 |
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) |
| 356 |
errs = 1; |
| 357 |
} |
| 358 |
} |
| 359 |
exit(errs != 0); |
359 |
exit(errs != 0); |
| 360 |
} |
360 |
} |
| 361 |
|
361 |
|
|
Lines 451-457
Link Here
|
| 451 |
void |
451 |
void |
| 452 |
tolocal(int argc, char **argv) |
452 |
tolocal(int argc, char **argv) |
| 453 |
{ |
453 |
{ |
| 454 |
int i, len; |
454 |
int i, len, status; |
| 455 |
char *bp, *host, *src, *suser; |
455 |
char *bp, *host, *src, *suser; |
| 456 |
|
456 |
|
| 457 |
for (i = 0; i < argc - 1; i++) { |
457 |
for (i = 0; i < argc - 1; i++) { |
|
Lines 494-499
Link Here
|
| 494 |
sink(1, argv + argc - 1); |
494 |
sink(1, argv + argc - 1); |
| 495 |
(void) close(remin); |
495 |
(void) close(remin); |
| 496 |
remin = remout = -1; |
496 |
remin = remout = -1; |
|
|
497 |
if (do_cmd_pid != -1 && errs == 0) { |
| 498 |
if (remin != -1) |
| 499 |
(void) close(remin); |
| 500 |
if (remout != -1) |
| 501 |
(void) close(remout); |
| 502 |
if (waitpid(do_cmd_pid, &status, 0) == -1) |
| 503 |
errs = 1; |
| 504 |
else { |
| 505 |
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) |
| 506 |
errs = 1; |
| 507 |
} |
| 508 |
} |
| 497 |
} |
509 |
} |
| 498 |
} |
510 |
} |
| 499 |
|
511 |
|