Launchpadlib support in Ubuntu Developer Tools
stefan.potyra at informatik.uni-erlangen.de
Thu Jan 15 10:07:46 GMT 2009
On Thursday 15 January 2009 01:48:44 Kees Cook wrote:
> Now I have to redeem my embarrassment by suggesting this as a way to avoid
> the create/chmod race when fchmod is unavailable:
> credfd = tempfile.NamedTemporaryFile(dir=os.path.dirname(credfile))
> os.link(credfd.name, credfile)
> The link will fail if the target exists, and the close will clean up the
> original file. Wheee :)
how about simply using os.open() to avoid the race in the first place?
Or mangle the umask to the right thing before the (fd)open?
More information about the ubuntu-devel