summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2019-05-10 04:39:08 +0000
committerratchov <ratchov@openbsd.org>2019-05-10 04:39:08 +0000
commit16a992939aada07201d51290eafb11e510135885 (patch)
treed983af63d90f8161a0acb688c22cb6e0cb1ae297
parentsimplify logic after wakeup since this variable is only manipulated (diff)
downloadwireguard-openbsd-16a992939aada07201d51290eafb11e510135885.tar.xz
wireguard-openbsd-16a992939aada07201d51290eafb11e510135885.zip
Don't try to send to device helper process if it's terminated.
-rw-r--r--usr.bin/sndiod/fdpass.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/sndiod/fdpass.c b/usr.bin/sndiod/fdpass.c
index a74aacfdcaa..67c2f665077 100644
--- a/usr.bin/sndiod/fdpass.c
+++ b/usr.bin/sndiod/fdpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdpass.c,v 1.4 2017/11/20 17:26:39 ratchov Exp $ */
+/* $OpenBSD: fdpass.c,v 1.5 2019/05/10 04:39:08 ratchov Exp $ */
/*
* Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org>
*
@@ -253,6 +253,8 @@ fdpass_sio_open(int num, unsigned int mode)
{
int fd;
+ if (fdpass_peer == NULL)
+ return NULL;
if (!fdpass_send(fdpass_peer, FDPASS_OPEN_SND, num, mode, -1))
return NULL;
if (!fdpass_waitret(fdpass_peer, &fd))
@@ -267,6 +269,8 @@ fdpass_mio_open(int num, unsigned int mode)
{
int fd;
+ if (fdpass_peer == NULL)
+ return NULL;
if (!fdpass_send(fdpass_peer, FDPASS_OPEN_MIDI, num, mode, -1))
return NULL;
if (!fdpass_waitret(fdpass_peer, &fd))