discover/file: Add sensible perms when using replace_file
authorJeremy Kerr <jk@ozlabs.org>
Thu, 15 Aug 2013 07:28:06 +0000 (15:28 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 16 Aug 2013 04:43:39 +0000 (12:43 +0800)
Rather than no access at all, use a default of 0644.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/file.c

index 1ebfe43b10ba02029dbedac3b8fcf0c3a088d7de..0cee43b897cd59e9f50f0b20d528c470cf6dd642 100644 (file)
@@ -115,6 +115,9 @@ int replace_file(const char *filename, char *buf, int len)
        }
 
        free(tempfile);
+
+       fchmod(fd, 0644);
+
        close(fd);
        return rc;
 }