From 4634ee16ac7a9b61593ac10fc118edc07113182e Mon Sep 17 00:00:00 2001 From: dtucker Date: Tue, 12 Jun 2007 13:41:06 +0000 Subject: [PATCH] - djm@cvs.openbsd.org 2007/06/12 08:24:20 [scp.c] make scp try to skip FIFOs rather than blocking when nothing is listening. depends on the platform supporting sane O_NONBLOCK semantics for open on FIFOs (apparently POSIX does not mandate this), which OpenBSD does. bz #856; report by cjwatson AT debian.org; ok markus@ --- ChangeLog | 6 ++++++ scp.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3a89f62..a659fb57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,12 @@ [ssh-gss.h gss-serv.c gss-genr.c] relocate server-only GSSAPI code from libssh to server; bz #1225 patch from simon AT sxw.org.uk; ok markus@ dtucker@ + - djm@cvs.openbsd.org 2007/06/12 08:24:20 + [scp.c] + make scp try to skip FIFOs rather than blocking when nothing is listening. + depends on the platform supporting sane O_NONBLOCK semantics for open + on FIFOs (apparently POSIX does not mandate this), which OpenBSD does. + bz #856; report by cjwatson AT debian.org; ok markus@ 20070611 - (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit diff --git a/scp.c b/scp.c index a52aaeb1..087e64a4 100644 --- a/scp.c +++ b/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.156 2007/01/22 13:06:21 djm Exp $ */ +/* $OpenBSD: scp.c,v 1.157 2007/06/12 08:24:20 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -596,12 +596,13 @@ source(int argc, char **argv) name); goto next; } - if ((fd = open(name, O_RDONLY, 0)) < 0) + if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0) goto syserr; if (fstat(fd, &stb) < 0) { syserr: run_err("%s: %s", name, strerror(errno)); goto next; } + unset_nonblock(fd); switch (stb.st_mode & S_IFMT) { case S_IFREG: break; -- 2.45.2