[MLton-commit] r4175

Matthew Fluet MLton@mlton.org
Tue, 8 Nov 2005 14:05:24 -0800


Open/Create files with appropriate permission
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile	2005-11-08 21:27:52 UTC (rev 4174)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile	2005-11-08 22:05:22 UTC (rev 4175)
@@ -165,7 +165,6 @@
 	rm -f types.h
 	$(CC) $(CFLAGS) $(WARNFLAGS) -o gen-types gen/gen-types.c $(UTILOFILES)
 	./gen-types
-	chmod a+r types.h
 	rm -f gen-types
 
 gc-gdb.o: gc.c $(GCCFILES) $(HFILES) 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c	2005-11-08 21:27:52 UTC (rev 4174)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c	2005-11-08 22:05:22 UTC (rev 4175)
@@ -328,12 +328,12 @@
     if (s->controls.messages)
       fprintf (stderr, "Paging heap from "FMTPTR" to %s.\n", 
                (uintptr_t)orig, template);
-    fd = open_safe (template, O_WRONLY, 0);
+    fd = open_safe (template, O_WRONLY, S_IRUSR | S_IWUSR);
     write_safe (fd, orig, size);
     close_safe (fd);
     releaseHeap (s, curHeapp);
     if (createHeap (s, curHeapp, desiredSize, minSize)) {
-      fd = open_safe (template, O_RDONLY, 0);
+      fd = open_safe (template, O_RDONLY, S_IRUSR | S_IWUSR);
       read_safe (fd, curHeapp->start, size);
       close_safe (fd);
       unlink_safe (template);

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c	2005-11-08 21:27:52 UTC (rev 4174)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c	2005-11-08 22:05:22 UTC (rev 4175)
@@ -82,7 +82,7 @@
 int main (int argc, char* argv[]) {
   int fd;
 
-  fd = open_safe ("types.h", O_RDWR | O_CREAT, 0);
+  fd = open_safe ("types.h", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
   for (int i = 0; i < prefixLines; i++) {
     writeString (fd, prefix[i]);
     writeNewline (fd);