get_ssh_size: use -n to redirect stdin from /dev/null

Resolves: bug 868990

ssh will send local stdin input to remote side, this cause trouble
when we call ssh in the loop of parsing kdump.conf.

Ie. if we specify both 'ssh' and 'core_collector' option in kdump.conf,
and put 'core_collector' behind 'ssh', there will be no chance to
handle 'core_collector' because in get_ssh_size() ssh eat all the later
input of the while loop.

Fix this by use /dev/null as stdin in get_ssh_size().

Tested in fedora kvm guest.

Signed-off-by: Dave Young <dyoung@redhat.com>
Suggested-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
dyoung@redhat.com 2012-11-12 16:51:04 +08:00 committed by Dave Young
parent c5c4a7b8b0
commit 4d9bb7face
1 changed files with 1 additions and 1 deletions

View File

@ -101,7 +101,7 @@ to_mount_point() {
get_ssh_size() {
local _opt _out _size
_opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
_out=$(ssh -q $_opt $1 "df -P $SAVE_PATH")
_out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH")
if [ $? -ne 0 ]; then
echo "checking remote ssh server available size failed."
exit 1