Skip to content

Commit

Permalink
Calls to chdir(2) should be error checked
Browse files Browse the repository at this point in the history
* Bad things can happen if you don't sanity check cd
  • Loading branch information
bahamas10 committed May 25, 2012
1 parent df278fa commit 296fd39
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions bin/mad
Expand Up @@ -118,14 +118,16 @@ install_all_remote() {
local path=${0%/*}/../share/mad local path=${0%/*}/../share/mad
echo echo
echo " ... cloning repo" echo " ... cloning repo"
cd /tmp && rm -fr mad-pages cd /tmp && rm -fr mad-pages || exit 2
git clone --depth 1 $REMOTE mad-pages if git clone --depth 1 $REMOTE mad-pages && cd mad-pages; then
cd mad-pages for page in *.md; do
for page in *.md; do echo " ... installing $page"
echo " ... installing $page" cp -f $page $path/$page
cp -f $page $path/$page done
done echo " ... complete"
echo " ... complete" else
echo " ... failed!" >&2
fi
echo echo
} }


Expand All @@ -136,10 +138,13 @@ install_all_remote() {
install_mad() { install_mad() {
echo echo
echo " ... cloning repo" echo " ... cloning repo"
cd /tmp && rm -fr mad cd /tmp && rm -fr mad || exit 3
git clone --depth 1 $REMOTE_MAD mad git clone --depth 1 $REMOTE_MAD mad
cd mad && make install if cd mad && make install; then
echo " ... updated to $(mad --version)" echo " ... updated to $(mad --version)"
else
echo " ... failed to update!" >&2
fi
echo echo
} }


Expand Down

0 comments on commit 296fd39

Please sign in to comment.