[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] dlm_tool: Fix silly error:



If you do

   # dlm_tool lockdump default

on a lockspace with no locks in it, you get the error message:

   can't read /sys/kernel/debug/dlm/default_locks: Success

This patch puts a slightly more sensible error message in place.

Chrissie
diff --git a/dlm/tool/main.c b/dlm/tool/main.c
index 631fb56..4553785 100644
--- a/dlm/tool/main.c
+++ b/dlm/tool/main.c
@@ -947,8 +947,13 @@ void do_lockdump(char *name)
 	}
 
 	/* skip the header on the first line */
-	if(!fgets(line, LOCK_LINE_MAX, file)) {
-		fprintf(stderr, "can't read %s: %s\n", path, strerror(errno));
+	if(! (rv = fgets(line, LOCK_LINE_MAX, file))) {
+		if (rv == 0) {
+			fprintf(stderr, "No locks in lockspace %s\n", name);
+		}
+		else {
+			fprintf(stderr, "can't read %s: %s\n", path, strerror(errno));
+		}
 		return;
 	}
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]