Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Check sourcelink is set before passing to readlink
Browse files Browse the repository at this point in the history
When no source was found in any of the expected paths treat
this as fatal and provide the user with a hint as to what
they should do.
  • Loading branch information
behlendorf committed Jul 1, 2010
1 parent 55f10ae commit 8fd4e3a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
7 changes: 4 additions & 3 deletions config/spl-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ AC_DEFUN([SPL_AC_KERNEL], [
2>/dev/null | grep -v obj | tail -1)
fi
if test -e ${sourcelink}; then
if test -n "$sourcelink" && test -e ${sourcelink}; then
kernelsrc=`readlink -f ${sourcelink}`
else
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([
*** Please specify the location of the kernel source
*** with the '--with-linux=PATH' option])
*** Please make sure the kernel devel package for your distribution
*** is installed then try again. If that fails you can specify the
*** location of the kernel source with the '--with-linux=PATH' option.])
fi
else
if test "$kernelsrc" = "NONE"; then
Expand Down
24 changes: 14 additions & 10 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -11504,17 +11504,19 @@ $as_echo_n "checking kernel source directory... " >&6; }
2>/dev/null | grep -v obj | tail -1)
fi

if test -e ${sourcelink}; then
if test -n "$sourcelink" && test -e ${sourcelink}; then
kernelsrc=`readlink -f ${sourcelink}`
else
{ $as_echo "$as_me:$LINENO: result: Not found" >&5
$as_echo "Not found" >&6; }
{ { $as_echo "$as_me:$LINENO: error:
*** Please specify the location of the kernel source
*** with the '--with-linux=PATH' option" >&5
*** Please make sure the kernel devel package for your distribution
*** is installed then try again. If that fails you can specify the
*** location of the kernel source with the '--with-linux=PATH' option." >&5
$as_echo "$as_me: error:
*** Please specify the location of the kernel source
*** with the '--with-linux=PATH' option" >&2;}
*** Please make sure the kernel devel package for your distribution
*** is installed then try again. If that fails you can specify the
*** location of the kernel source with the '--with-linux=PATH' option." >&2;}
{ (exit 1); exit 1; }; }
fi
else
Expand Down Expand Up @@ -14974,17 +14976,19 @@ $as_echo_n "checking kernel source directory... " >&6; }
2>/dev/null | grep -v obj | tail -1)
fi

if test -e ${sourcelink}; then
if test -n "$sourcelink" && test -e ${sourcelink}; then
kernelsrc=`readlink -f ${sourcelink}`
else
{ $as_echo "$as_me:$LINENO: result: Not found" >&5
$as_echo "Not found" >&6; }
{ { $as_echo "$as_me:$LINENO: error:
*** Please specify the location of the kernel source
*** with the '--with-linux=PATH' option" >&5
*** Please make sure the kernel devel package for your distribution
*** is installed then try again. If that fails you can specify the
*** location of the kernel source with the '--with-linux=PATH' option." >&5
$as_echo "$as_me: error:
*** Please specify the location of the kernel source
*** with the '--with-linux=PATH' option" >&2;}
*** Please make sure the kernel devel package for your distribution
*** is installed then try again. If that fails you can specify the
*** location of the kernel source with the '--with-linux=PATH' option." >&2;}
{ (exit 1); exit 1; }; }
fi
else
Expand Down

0 comments on commit 8fd4e3a

Please sign in to comment.