mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 00:04:30 +02:00
partial sync of regress/netcat.c with upstream
The code in socks.c writes multiple times in a row to a socket. If the socket becomes invalid between these calls (e.g. connection closed), write will throw SIGPIPE. With this patch, SIGPIPE is ignored so we can handle write's -1 return value (errno will be EPIPE). Ultimately, it leads to program exit, too -- but with nicer error message. :) with input by and ok djm
This commit is contained in:
parent
bf3893dddd
commit
d6a81050ac
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: netcat.c,v 1.128 2015/03/26 10:36:03 tobias Exp $ */
|
/* $OpenBSD: netcat.c,v 1.129 2015/03/26 21:22:50 tobias Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
|
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
|
||||||
*
|
*
|
||||||
@ -44,14 +44,15 @@
|
|||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include "atomicio.h"
|
#include "atomicio.h"
|
||||||
|
|
||||||
#ifdef HAVE_POLL_H
|
#ifdef HAVE_POLL_H
|
||||||
@ -162,6 +163,8 @@ main(int argc, char *argv[])
|
|||||||
uport = NULL;
|
uport = NULL;
|
||||||
sv = NULL;
|
sv = NULL;
|
||||||
|
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv,
|
while ((ch = getopt(argc, argv,
|
||||||
"46DdFhI:i:klNnO:P:p:rSs:tT:UuV:vw:X:x:z")) != -1) {
|
"46DdFhI:i:klNnO:P:p:rSs:tT:UuV:vw:X:x:z")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user