Restore getpath.c closer to upstream am: 99f2754365
am: e9611a6c97

Change-Id: I49015bd307f96a9fe4ecd7857c700f027cc77d65