
January 2015. A Steam beta update ships an install script that runs rm -rf on "$STEAMROOT"/. Normally STEAMROOT points at your Steam folder. But when the variable comes back empty, that line quietly becomes rm -rf /, and a handful of Linux users watched Steam erase their whole home directory, mounted backup drives included. One missing check sat between a value and a delete. Put it back.
Objective
Refuse the delete when the target path is empty or the bare filesystem root, so an unset variable cannot wipe everything.
Steps
$ safe_rm_target("/home/steam")
1
$ safe_rm_target("")
0
$ safe_rm_target("/")
0
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...