[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

d-l [PATCH] cat /dev/null



This patch uses shell redirection to truncate without additional
commands/forks/files.

diff -ur 1/live-helper/helpers/lh_chroot_hosts 2/live-helper/helpers/lh_chroot_hosts
--- 1/live-helper/helpers/lh_chroot_hosts	2007-11-03 22:27:25.000000000 -0400
+++ 2/live-helper/helpers/lh_chroot_hosts	2007-11-06 16:06:10.000000000 -0500
@@ -89,7 +89,7 @@
 		else
 			# Blank out hosts file, don't remove in case
 			# its a symlink, as in the case of exposedroot mode
-			cat /dev/null > chroot/etc/hosts
+			: >chroot/etc/hosts
 		fi
 
 		# Removing stage file
diff -ur 1/live-helper/helpers/lh_chroot_resolv 2/live-helper/helpers/lh_chroot_resolv
--- 1/live-helper/helpers/lh_chroot_resolv	2007-11-03 22:27:25.000000000 -0400
+++ 2/live-helper/helpers/lh_chroot_resolv	2007-11-06 16:06:31.000000000 -0500
@@ -80,7 +80,7 @@
 			mv chroot/etc/resolv.conf.orig chroot/etc/resolv.conf
 		else
 			# Truncating resolv file
-			cat < /dev/null > chroot/etc/resolv.conf
+			: >chroot/etc/resolv.conf
 		fi
 
 		# Removing stage file
diff -ur 1/live-helper/hooks/mini 2/live-helper/hooks/mini
--- 1/live-helper/hooks/mini	2007-11-03 22:27:25.000000000 -0400
+++ 2/live-helper/hooks/mini	2007-11-06 16:06:56.000000000 -0500
@@ -40,5 +40,5 @@
 # Truncating logs
 for FILE in $(find /var/log/ -type f)
 do
-	cat < /dev/null > $FILE
+	: >$FILE
 done
diff -ur 1/live-helper/hooks/minimal 2/live-helper/hooks/minimal
--- 1/live-helper/hooks/minimal	2007-11-03 22:27:25.000000000 -0400
+++ 2/live-helper/hooks/minimal	2007-11-06 16:07:33.000000000 -0500
@@ -32,5 +32,5 @@
 # Truncating logs
 for FILE in $(find /var/log/ -type f)
 do
-	cat < /dev/null > $FILE
+	: >$FILE
 done



Reply to: