View | Details | Raw Unified | Return to bug 1261
Collapse All | Expand All

(-)ssh.c (-7 / +12 lines)
Lines 1458-1481 Link Here
1458
1458
1459
	/* Stick around until the controlee closes the client_fd */
1459
	/* Stick around until the controlee closes the client_fd */
1460
	exitval = 0;
1460
	exitval = 0;
1461
	for (;!control_client_terminate;) {
1461
	for (i = 0; !control_client_terminate && i < (int)sizeof(exitval);) {
1462
		r = read(sock, &exitval, sizeof(exitval));
1462
		r = read(sock, &exitval, sizeof(exitval));
1463
		if (r == 0) {
1463
		if (r == 0) {
1464
			debug2("Received EOF from master");
1464
			debug2("Received EOF from master");
1465
			break;
1465
			break;
1466
		}
1466
		}
1467
		if (r > 0)
1467
		if (r > 0) {
1468
			debug2("Received exit status from master %d", exitval);
1468
			debug2("Received exit status from master %d", exitval);
1469
			i += r;
1470
		}
1469
		if (r == -1 && errno != EINTR)
1471
		if (r == -1 && errno != EINTR)
1470
			fatal("%s: read %s", __func__, strerror(errno));
1472
			fatal("%s: read %s", __func__, strerror(errno));
1471
	}
1473
	}
1472
1473
	if (control_client_terminate)
1474
		debug2("Exiting on signal %d", control_client_terminate);
1475
1476
	close(sock);
1474
	close(sock);
1477
1478
	leave_raw_mode();
1475
	leave_raw_mode();
1476
1477
	if (control_client_terminate) {
1478
		debug2("Exiting on signal %d", control_client_terminate);
1479
		exitval = 255;
1480
	} else if (i < (int)sizeof(exitval)) {
1481
		debug2("Control master terminated unexpectedly");
1482
		exitval = 255;
1483
	}
1479
1484
1480
	if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET)
1485
	if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET)
1481
		fprintf(stderr, "Connection to master closed.\r\n");
1486
		fprintf(stderr, "Connection to master closed.\r\n");

Return to bug 1261