X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Ffile.c;h=1bde9fb805ba906c95ca4ec24df9d1dc921994af;hp=1ebfe43b10ba02029dbedac3b8fcf0c3a088d7de;hb=08e967ee301b502b2114e3855210a0b2600d095c;hpb=6557f07325409d769f414035cca05a563418e729 diff --git a/discover/file.c b/discover/file.c index 1ebfe43..1bde9fb 100644 --- a/discover/file.c +++ b/discover/file.c @@ -103,7 +103,7 @@ int replace_file(const char *filename, char *buf, int len) fd = mkstemp(tempfile); umask(oldmask); if (fd < 0) { - free(tempfile); + talloc_free(tempfile); return fd; } @@ -114,7 +114,10 @@ int replace_file(const char *filename, char *buf, int len) rc = rename(tempfile, filename); } - free(tempfile); + talloc_free(tempfile); + + fchmod(fd, 0644); + close(fd); return rc; }