Skip to contentSkip to conversation

Do not fail lvm_init() if init_logging() generates an errno.

PATCH New Dave Wysochanski 1 participant 2 messages Jun 1, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Do not fail lvm_init() if init_logging() generates an errno.

Revert to original behavior of lvm commands if init_logging() generated an errno. Fixes rhbz 592967.

---
 lib/commands/toolcontext.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
lib/commands/toolcontext.c +1 -0
index 890da3e..33e682b 100644
@@ -195,6 +195,7 @@ static void _init_logging(struct cmd_context *cmd)
 	dm_log_with_errno_init(print_log);
 #endif
 	reset_log_duplicated();
+	reset_lvm_errno(1);
 }
 
 static int _process_config(struct cmd_context *cmd)
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 2/2 Revert _init_rand() to reset errno - restores original init behavior.

---
 lib/commands/toolcontext.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib/commands/toolcontext.c +4 -1
index 33e682b..7c5e379 100644
@@ -1084,10 +1084,13 @@ static int _init_backup(struct cmd_context *cmd)
 
 static void _init_rand(struct cmd_context *cmd)
 {
-	if (read_urandom(&cmd->rand_seed, sizeof(cmd->rand_seed)))
+	if (read_urandom(&cmd->rand_seed, sizeof(cmd->rand_seed))) {
+		reset_lvm_errno(1);
 		return;
+	}
 
 	cmd->rand_seed = (unsigned) time(NULL) + (unsigned) getpid();
+	reset_lvm_errno(1);
 }
 
 static void _init_globals(struct cmd_context *cmd)
Signature · 1 line
1.6.0.6