Better error checking in drop_privs().