diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2007-06-12 08:24:21 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2007-06-12 08:24:21 +0000 |
commit | 11eb6eef768bd40866428bbb50915e5da9f17677 (patch) | |
tree | a2bcd6c0684879bb1f4d156985f4be581b8d30aa | |
parent | c748bfc6e444031fed4ba967cddd64a7c9d412fb (diff) |
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@
-rw-r--r-- | usr.bin/ssh/scp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index 6e8bb748498..d8238af2d88 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/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). @@ -583,12 +583,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; |