From: Sascha Wildner Date: Tue, 16 Oct 2012 04:36:09 +0000 (+0200) Subject: monitor(1): Check kevent(). X-Git-Tag: v3.4.0rc~991^2~39 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/09af4d5f0e15a047a358679c7956fd4f8093dd0f monitor(1): Check kevent(). Found-by: gcc47 --- diff --git a/usr.bin/monitor/monitor.c b/usr.bin/monitor/monitor.c index bb438dc8f7..277b006638 100644 --- a/usr.bin/monitor/monitor.c +++ b/usr.bin/monitor/monitor.c @@ -122,7 +122,7 @@ monitor_add(const char *path) { monitor_elm_t elm; struct kevent kev; - int __unused n; + int n; elm = malloc(sizeof(*elm)); bzero(elm, sizeof(*elm)); @@ -137,6 +137,10 @@ monitor_add(const char *path) NOTE_LINK|NOTE_RENAME|NOTE_REVOKE, 0, NULL); n = kevent(KQueueFd, &kev, 1, NULL, 0, NULL); + if (n < 0) { + perror("kqueue"); + exit(1); + } if (elm->fd >= NumFiles) { MaxFiles = (elm->fd + 16) * 3 / 2;