From d1058f28e93a4ec4eefc93d2d3aa7907c7f6d238 Mon Sep 17 00:00:00 2001
From: Stefan Lankes <slankes@eonerc.rwth-aachen.de>
Date: Sat, 18 Feb 2017 13:20:43 +0100
Subject: [PATCH] add check if inotify_add_watch returns descriptor

---
 tools/proxy.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/proxy.c b/tools/proxy.c
index 66f7c00aa..5a86a9b07 100644
--- a/tools/proxy.c
+++ b/tools/proxy.c
@@ -250,6 +250,11 @@ static void wait_hermit_available(void)
 	else
 		wd = inotify_add_watch(fd, "/sys/hermit", IN_MODIFY|IN_CREATE);
 
+	if (wd < 0) {
+		perror("inotify_add_watch");
+		exit(1);
+	}
+
 	while(1) {
 		int length = read(fd, buffer, BUF_LEN);