Deleted Added
sdiff udiff text old ( 181111 ) new ( 192595 )
full compact
1/* $OpenBSD: nchan.c,v 1.60 2008/06/30 12:16:02 djm Exp $ */
2/*
3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 372 unchanged lines hidden (view full) ---

382chan_send_eow2(Channel *c)
383{
384 debug2("channel %d: send eow", c->self);
385 if (c->ostate == CHAN_OUTPUT_CLOSED) {
386 error("channel %d: must not sent eow on closed output",
387 c->self);
388 return;
389 }
390 packet_start(SSH2_MSG_CHANNEL_REQUEST);
391 packet_put_int(c->remote_id);
392 packet_put_cstring("eow@openssh.com");
393 packet_put_char(0);
394 packet_send();
395}
396
397/* shared */

--- 81 unchanged lines hidden (view full) ---

479 buffer_clear(&c->output);
480 if (compat20 && c->type == SSH_CHANNEL_LARVAL)
481 return;
482 /* shutdown failure is allowed if write failed already */
483 debug2("channel %d: close_write", c->self);
484 if (c->sock != -1) {
485 if (shutdown(c->sock, SHUT_WR) < 0)
486 debug2("channel %d: chan_shutdown_write: "
487 "shutdown() failed for fd%d: %.100s",
488 c->self, c->sock, strerror(errno));
489 } else {
490 if (channel_close_fd(&c->wfd) < 0)
491 logit("channel %d: chan_shutdown_write: "
492 "close() failed for fd%d: %.100s",
493 c->self, c->wfd, strerror(errno));
494 }
495}
496static void
497chan_shutdown_read(Channel *c)
498{
499 if (compat20 && c->type == SSH_CHANNEL_LARVAL)
500 return;
501 debug2("channel %d: close_read", c->self);
502 if (c->sock != -1) {
503 /*
504 * shutdown(sock, SHUT_READ) may return ENOTCONN if the
505 * write side has been closed already. (bug on Linux)
506 * HP-UX may return ENOTCONN also.
507 */
508 if (shutdown(c->sock, SHUT_RD) < 0
509 && errno != ENOTCONN)
510 error("channel %d: chan_shutdown_read: "
511 "shutdown() failed for fd%d [i%d o%d]: %.100s",
512 c->self, c->sock, c->istate, c->ostate,
513 strerror(errno));
514 } else {
515 if (channel_close_fd(&c->rfd) < 0)
516 logit("channel %d: chan_shutdown_read: "
517 "close() failed for fd%d: %.100s",
518 c->self, c->rfd, strerror(errno));
519 }
520}