[OE-core] [PATCH 07/20] udev-cache: Update cache tarball atomically
Ben Shelton
ben.shelton at ni.com
Mon Aug 4 18:40:59 UTC 2014
From: Richard Tollerton <rich.tollerton at ni.com>
Overwriting the tarball in-place could cause a partial write, if the
system stops at an inopportune time. This is mitigated by first writing to a
temporary file, then moving that file on top of the final location.
Natinst-Rally-ID: TA44427
Acked-by: Gratian Crisan <gratian.crisan at ni.com>
Natinst-ReviewBoard-ID: 58620
Signed-off-by: Richard Tollerton <rich.tollerton at ni.com>
---
meta/recipes-core/udev/udev/udev-cache | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 11c5f0e..679adb4 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -25,7 +25,8 @@ fi
if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
- tar czf "$DEVCACHE" dev -C / --exclude=log
+ tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
+ mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
mv /dev/shm/udev.cache /etc/udev/cache.data
fi
--
2.0.4
More information about the Openembedded-core
mailing list