From df26bc943f5f7e064668a1fea5046e9b0c2b7a46 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Fri, 25 Aug 2017 16:30:31 -0600
Subject: [PATCH] Add function error check

Coverity CID 44775
---
 src/slurmd/slurmd/read_proc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/slurmd/slurmd/read_proc.c b/src/slurmd/slurmd/read_proc.c
index d6c257230b5..21097844348 100644
--- a/src/slurmd/slurmd/read_proc.c
+++ b/src/slurmd/slurmd/read_proc.c
@@ -281,7 +281,10 @@ read_proc(void)
 			if (lseek(proc_fd, (off_t) 0, SEEK_SET) != 0) 
 				break;
 		}
-		fstat(proc_fd, &buffer);
+		if (fstat(proc_fd, &buffer) < 0) {
+			debug("%s: fstat(%s): %m", __func__, proc_name);
+			n = -1;
+		}
 		close(proc_fd);
 		if (n <= 0) 
 			continue;
-- 
GitLab