Browse code

utils/pdbt: Relax permissions when creating files

Kristian F. H√łgh authored on 21/10/2020 09:21:43 • Henning Westerholt committed on 21/10/2020 13:05:09
Showing 1 changed files
... ...
@@ -297,7 +297,7 @@ int dt_write_tree(const struct dt_node_t *root, const char* filename)
297 297
 	char number[25];
298 298
 	number[0] = '\0';
299 299
 
300
-	fd = creat(filename, S_IRWXU);
300
+	fd = creat(filename, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
301 301
 	if (fd < 0) {
302 302
 		LERR("cannot create file '%s'\n", filename);
303 303
 		return -1;
... ...
@@ -370,7 +370,7 @@ int save_mmap(struct dt_node_t *root, char *filename) {
370 370
 	int fd;
371 371
 	int n;
372 372
 
373
-	fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, S_IRWXU);
373
+	fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
374 374
 	if (fd < 0) {
375 375
 		LERR("cannot create file '%s'\n", filename);
376 376
 		return -1;