summaryrefslogtreecommitdiff
path: root/aux.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-05-17 22:34:22 +1000
committerDamien Miller <djm@mindrot.org>2000-05-17 22:34:22 +1000
commitdcb6ecd1b3b25b6909296ff0546ca6b18d0c19d3 (patch)
tree7eb6d184356f6aa00e62c71565568db706f2e960 /aux.c
parent0e65eed58acc0053d163e96463a7c4d0684e55bd (diff)
- OpenBSD CVS update:
- markus@cvs.openbsd.org [ssh.c] fix usage() [ssh2.h] draft-ietf-secsh-architecture-05.txt [ssh.1] document ssh -T -N (ssh2 only) [channels.c serverloop.c ssh.h sshconnect.c sshd.c aux.c] enable nonblocking IO for sshd w/ proto 1, too; split out common code [aux.c] missing include
Diffstat (limited to 'aux.c')
-rw-r--r--aux.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/aux.c b/aux.c
new file mode 100644
index 000000000..899142da7
--- /dev/null
+++ b/aux.c
@@ -0,0 +1,36 @@
1#include "includes.h"
2RCSID("$OpenBSD: aux.c,v 1.2 2000/05/17 09:47:59 markus Exp $");
3
4#include "ssh.h"
5
6char *
7chop(char *s)
8{
9 char *t = s;
10 while (*t) {
11 if(*t == '\n' || *t == '\r') {
12 *t = '\0';
13 return s;
14 }
15 t++;
16 }
17 return s;
18
19}
20
21void
22set_nonblock(int fd)
23{
24 int val;
25 val = fcntl(fd, F_GETFL, 0);
26 if (val < 0) {
27 error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
28 return;
29 }
30 if (val & O_NONBLOCK)
31 return;
32 debug("fd %d setting O_NONBLOCK", fd);
33 val |= O_NONBLOCK;
34 if (fcntl(fd, F_SETFL, val) == -1)
35 error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
36}