diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2006-08-30 18:26:34 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2006-08-30 18:26:34 +0000 |
commit | 8e587110ac1576db9e2b457524787e0224278729 (patch) | |
tree | 1ab38eadc43f91085c78a3f3011686a2f906e566 /usr.sbin | |
parent | 31a8a2cab802b051882630b7a3ad6df9ccbcadbc (diff) |
need to retry writing to pfkey socket on EAGAIN, ok theo
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sasyncd/pfkey.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/sasyncd/pfkey.c b/usr.sbin/sasyncd/pfkey.c index b97a3826895..5458561490c 100644 --- a/usr.sbin/sasyncd/pfkey.c +++ b/usr.sbin/sasyncd/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.15 2006/06/02 20:31:48 moritz Exp $ */ +/* $OpenBSD: pfkey.c,v 1.16 2006/08/30 18:26:33 henning Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -72,11 +72,15 @@ static int pfkey_write(u_int8_t *buf, ssize_t len) { struct sadb_msg *msg = (struct sadb_msg *)buf; + ssize_t n; if (cfgstate.pfkey_socket == -1) return 0; - if (write(cfgstate.pfkey_socket, buf, len) != len) { + do { + n = write(cfgstate.pfkey_socket, buf, len); + } while (n == -1 && (errno == EAGAIN || errno == EINTR)); + if (n == -1) { log_err("pfkey: msg %s write() failed on socket %d", pfkey_print_type(msg), cfgstate.pfkey_socket); return -1; |