This commit is a "cherry-pick" by hand of the two commits in ompi/master

AKA the trunk from Devedar. This contains commits:

cbb3e95
8dfed1c

from the trunk. This fixes the OSHMEM global exit when launched under srun.