From: Richard Tollerton <rich.toller...@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.cri...@ni.com>
Natinst-ReviewBoard-ID: 58620
Signed-off-by: Richard Tollerton <rich.toller...@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

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to