diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-09 00:03:49 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-09 00:13:58 -0700 |
commit | 8020a9e44fffb687d4372c59239958776302a8ae (patch) | |
tree | 613a13810665cfe629e3cc079163dae795d84a50 /scripts/runqemu-internal | |
parent | ecec4af3021b1fe0bac7b441f4e0364ce1a4d251 (diff) | |
download | poky-8020a9e44fffb687d4372c59239958776302a8ae.tar.gz |
runqemu: Add error handling for unexpected tap devices
In theory the code reduces the tap device number to an integer. This
patch adds error checking to ensure that does happen and that the script
exits if something unexpected happens.
(From OE-Core rev: 4238f3b6e320969aaf539e6afb1cb2bfd61bb28b)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-internal')
-rwxr-xr-x | scripts/runqemu-internal | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 03b40d8323..0ace485cb8 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal | |||
@@ -253,6 +253,14 @@ else | |||
253 | 253 | ||
254 | 254 | ||
255 | n0=$(echo $TAP | sed 's/tap//') | 255 | n0=$(echo $TAP | sed 's/tap//') |
256 | |||
257 | case $n0 in | ||
258 | ''|*[!0-9]*) | ||
259 | echo "Error Couldn't turn $TAP into an interface number?" | ||
260 | exit 1 | ||
261 | ;; | ||
262 | esac | ||
263 | |||
256 | n1=$(($n0 * 2 + 1)) | 264 | n1=$(($n0 * 2 + 1)) |
257 | n2=$(($n1 + 1)) | 265 | n2=$(($n1 + 1)) |
258 | 266 | ||