]> code.ossystems Code Review - openembedded-core.git/commitdiff
udev-cache: improve error handling
authorKen Sharp <ken.sharp@ni.com>
Tue, 21 Apr 2015 15:35:45 +0000 (10:35 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 15 May 2015 17:12:10 +0000 (18:12 +0100)
If an error occurs while the udev cache is being populated, the system
is left in a state where udev is stopped.  Remedy this with a clean up
function to restart udev and remove any intermediate files.

(From OE-Core master rev: af911b272ded95884079dc307eeeb1811f0584c9)

Signed-off-by: Ken Sharp <ken.sharp@ni.com>
Reviewed-by: Ben Shelton <ben.shelton@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/udev/udev/udev-cache

index 12f68fb825a761dd064662f25e84fd776cf83c93..dcfff1cb4535af8c967d2b67500538f0649ecc1a 100644 (file)
@@ -51,9 +51,15 @@ fi
 [ "${VERBOSE}" == "no" ] || echo "found."
 echo "Populating dev cache"
 
+err_cleanup () {
+        echo "udev-cache: update failed!"
+        udevadm control --start-exec-queue
+       rm -f -- "$SYSCONF_TMP" "$DEVCACHE_TMP" "$DEVCACHE" "$SYSCONF_CACHED"
+}
+
 (
        set -e
-       trap 'echo "udev-cache: update failed!"' EXIT
+       trap 'err_cleanup' EXIT
        udevadm control --stop-exec-queue
        sysconf_cmd > "$SYSCONF_TMP"
        find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \