[PC-BSD Commits] r8136 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Fri Dec 3 08:46:27 PST 2010


Author: kris
Date: 2010-12-03 08:46:27 -0800 (Fri, 03 Dec 2010)
New Revision: 8136

Modified:
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Make sure pbid doesnt exit if a hash-file fails to link, just print warning to the log and
keep on truckin'. Also make sure hard-linked files are not writable, so we don't have users / programs
trying to change a file that multiple PBIs rely upon



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-12-03 15:30:41 UTC (rev 8135)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-12-03 16:46:27 UTC (rev 8136)
@@ -2262,8 +2262,18 @@
 	# Got here, so we have a match!
 	if [ "$PBI_VERBOSE" = "YES" ] ; then echo "." ; fi
 	ln -f "${PBI_HASHDIR}/${tfile}" "${file}"
-	if [ "$?" != "0" ] ; then exit_err "Critical failure, exiting..."; fi
+	if [ "$?" != "0" ] ; then 
+		echo "Warning: Unable to make hash-link ${PBI_HASHDIR}/${tfile} -> ${file}"
+		return
+	fi
 	
+	# Make sure the hard-linked file doesn't get changed
+	chmod u-w,g-w,o-w "${file}"
+	if [ "$?" != "0" ] ; then 
+		echo "Warning: Unable to chmod "${file}""
+		return
+	fi
+	
 }
 
 # New file we can save to hashdir
@@ -2277,7 +2287,25 @@
 	fi
 
 	ln -f "${file}" "${PBI_HASHDIR}/${tfile}"
-	if [ "$?" != "0" ] ; then exit_err "Critical failure, exiting..."; fi
+	if [ "$?" != "0" ] ; then 
+		echo "Warning: Unable to make hash-link ${file} -> ${PBI_HASHDIR}/${tfile}"
+		return
+	fi
+
+	# Make sure the hard-linked file doesn't get changed
+	chmod u-w,g-w,o-w "${file}"
+	if [ "$?" != "0" ] ; then 
+		echo "Warning: Unable to chmod "${file}""
+		return
+	fi
+
+	# Make sure the hard-linked file doesn't get changed
+	chmod u-w,g-w,o-w "${PBI_HASHDIR}/${tfile}"
+	if [ "$?" != "0" ] ; then 
+		echo "Warning: Unable to chmod "${PBI_HASHDIR}/${tfile}""
+		return
+	fi
+
 	if [ "$PBI_VERBOSE" = "YES" ] ; then echo "L" ; fi
 }
 



More information about the Commits mailing list