Blob Blame History Raw
From 272ceb535415437041f989278635ac8de729cd6b Mon Sep 17 00:00:00 2001
From: Takao Indoh <indou.takao@jp.fujitsu.com>
Date: Thu, 5 Jun 2014 14:10:55 +0900
Subject: [PATCH 2/2] Fix mistaken check of stat(2) return value

get_crash_notes_per_cpu() should return -1 if return value of stat(2) is
zero (on success).

Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>
Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Acked-by: WANG Chao <chaowang@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 kexec/crashdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/crashdump.c b/kexec/crashdump.c
index 131e624..15c1105 100644
--- a/kexec/crashdump.c
+++ b/kexec/crashdump.c
@@ -84,7 +84,7 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
 		if (fopen_errno != ENOENT)
 			die("Could not open \"%s\": %s\n", crash_notes,
 			    strerror(fopen_errno));
-		if (!stat("/sys/devices", &cpu_stat)) {
+		if (stat("/sys/devices", &cpu_stat)) {
 			stat_errno = errno;
 			if (stat_errno == ENOENT)
 				die("\"/sys/devices\" does not exist. "
-- 
1.9.3