From a70f65817d71450c31c39c0e9a46b5739484da9e Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 27 Jul 2022 19:42:22 +0000 Subject: [PATCH] Print poll(2) errno Distinguish between return values -1 (errno set) and 0. OK kettenis --- usr.sbin/ldomd/ds.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/ldomd/ds.c b/usr.sbin/ldomd/ds.c index 47fc147a277..0090a6047a9 100644 --- a/usr.sbin/ldomd/ds.c +++ b/usr.sbin/ldomd/ds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ds.c,v 1.11 2021/10/24 21:24:18 deraadt Exp $ */ +/* $OpenBSD: ds.c,v 1.12 2022/07/27 19:42:22 kn Exp $ */ /* * Copyright (c) 2012 Mark Kettenis @@ -741,8 +741,10 @@ ds_conn_serve(void) while (1) { nfds = poll(pfd, num_ds_conns, -1); - if (nfds == -1 || nfds == 0) - errx(1, "poll"); + if (nfds == -1) + err(1, "poll"); + if (nfds == 0) + errx(1, "poll timeout"); TAILQ_FOREACH(dc, &ds_conns, link) { if (pfd[dc->id].revents) -- 2.20.1