[PATCH 2/9] Fix return value from break trap

Zdenek Kabelac <[email protected]>
Newsgroups dev.linux.lists.lvm-devel
Message-ID <a931feb62093ef1b53f24e754e97b18d08c7c689.1286460218.git.zkabelac@redhat.com>
This bug is serious as upon certain conditions it is possible
to break (^C) fsadm before actually resizing filesystem, but the
ongoing lvresize will think resize was succesful and shrinks
partition with unresized filesystem on it.

Signed-off-by: Zdenek Kabelac <[email protected]>
---
 scripts/fsadm.sh |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index aa6b2d9..2c6a21b 100644
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
 #
 # This file is part of LVM2.
 #
@@ -130,7 +130,8 @@ cleanup() {
 	# and allow recursive call of fsadm
 	unset FSADM_RUNNING
 	test "$DO_LVRESIZE" -eq 2 && exec $LVM lvresize $VERB -r -L$(( $NEWSIZE / 1048576 )) $VOLUME
-	exit ${1:-0}
+	# error exit status for break
+	exit ${1:-1}
 }
 
 # convert parameter from Exa/Peta/Tera/Giga/Mega/Kilo/Bytes and blocks
-- 
1.7.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.