Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ken Sharp <ken.sharp@ni.com>
To: openembedded-core@lists.openembedded.org
Cc: Ken Sharp <ken.sharp@ni.com>
Subject: [PATCH 2/2] udev-cache: improve error handling
Date: Tue, 21 Apr 2015 10:35:45 -0500	[thread overview]
Message-ID: <1429630545-17151-2-git-send-email-ken.sharp@ni.com> (raw)
In-Reply-To: <1429630545-17151-1-git-send-email-ken.sharp@ni.com>

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.

Signed-off-by: Ken Sharp <ken.sharp@ni.com>
Reviewed-by: Ben Shelton <ben.shelton@ni.com>
---
 meta/recipes-core/udev/udev/udev-cache | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 12f68fb..dcfff1c 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -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- \
-- 
1.9.1



      reply	other threads:[~2015-04-21 15:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 15:35 [PATCH 1/2] udev-cache: Remove unnecessary tar read from stdin Ken Sharp
2015-04-21 15:35 ` Ken Sharp [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429630545-17151-2-git-send-email-ken.sharp@ni.com \
    --to=ken.sharp@ni.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox