Bug 1028261 - Fix to exit with a non-zero code on errors

Fixed to handle both /storage/sdcard and /storage/sdcard0