The error handling in the code was doing exactly what one would not
expect. If we switch to a netns and then encounter an error, we
obviously have to switch back to the original netns before returning.
Likewise, if we temporarily change the signal mask, we need to switch
back to the original one before returning.
Change-Id: I9ff5ae7bffc5bd7629dae0af1b72cfea548f9039