omfsegdg: if input and output file are the same, make a temp file to write to then rename over original. fix open() permissions mask.
omfsegdg: if input and output file are the same, make a temp file to
write to then rename over original. fix open() permissions mask.

joncampbell123/doslib,joncampbell123/doslib,joncampbell123/doslib,joncampbell123/doslib,joncampbell123/doslib,joncampbell123/doslib