[pisa-src] r991 - trunk/openwrt/trunk

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 25 Sep 2009 18:35:20 +0200

Author: biurrun
Date: Fri Sep 25 18:35:20 2009
New Revision: 991

Log:
Sanitize paths before using them.
This allows passing relative paths to the script.

Modified:
   trunk/openwrt/trunk/configure_router.sh

Modified: trunk/openwrt/trunk/configure_router.sh
==============================================================================
--- trunk/openwrt/trunk/configure_router.sh     Fri Sep 25 17:46:37 2009        
(r990)
+++ trunk/openwrt/trunk/configure_router.sh     Fri Sep 25 18:35:20 2009        
(r991)
@@ -25,12 +25,17 @@
     fi
 }
 
+#This runs in a subshell to avoid changing directory unintentionally.
+sanitize_path () {
+    (cd $1; pwd)
+}
+
 
 ### set variables ###
 ROUTER_NAME=$1
-OPENWRT_PATH=$2
-PISA_PATH=$3
-HIPL_PATH=$4
+OPENWRT_PATH=$(sanitize_path $2)
+PISA_PATH=$(sanitize_path $3)
+HIPL_PATH=$(sanitize_path $4)
 
 PISA_OPENWRT_PATH=$PISA_PATH/openwrt/trunk
 

Other related posts:

  • » [pisa-src] r991 - trunk/openwrt/trunk - Diego Biurrun