From fc00db8f5d60ec661456da0d50c165b3400e1bbd Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 20 Jul 2008 10:28:57 -0400 Subject: [PATCH] Make shutdown command fail when there's no shutdown to cancel Before, it printed "Shutdown sequence begun", which was bogus. --- src/lib/commands/shut.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/commands/shut.c b/src/lib/commands/shut.c index 8a69db57..b91a5ce2 100644 --- a/src/lib/commands/shut.c +++ b/src/lib/commands/shut.c @@ -64,15 +64,19 @@ shut(void) if (shutdown_was_pending < 0) return RET_FAIL; - if (shutdown_was_pending) { - if (shutdown_minutes >= 0) { - pr("The shutdown time has been changed to %d minutes!", + if (shutdown_minutes >= 0) { + if (shutdown_was_pending) + pr("The shutdown time has been changed to %d minutes!\n", shutdown_minutes); - } else { - pr("The server shutdown has been cancelled!"); + else + pr("Shutdown sequence begun.\n"); + } else { + if (shutdown_was_pending) + pr("The server shutdown has been cancelled!\n"); + else { + pr("No shutdown to abort\n"); + return RET_FAIL; } - } else if (shutdown_minutes) { - pr("Shutdown sequence begun.\n"); } return RET_OK; }