2398713f34d6992ef64995a9737b724631771b35
braney
  Fri Jul 26 15:45:20 2019 -0700
let umask decide what modes should be set on created files

diff --git src/lib/common.c src/lib/common.c
index fc8de98..8910ce8 100644
--- src/lib/common.c
+++ src/lib/common.c
@@ -2677,31 +2677,31 @@
 char *success = fgets(buf, charCount, file);
 if (success == NULL && charCount > 0)
     buf[0] = '\0';
 if (ferror(file))
     errAbort("mustGetLine: fgets failed: %s", strerror(ferror(file)));
 }
 
 int mustOpenFd(char *fileName, int flags)
 /* Open a file descriptor (see man 2 open) or squawk and die. */
 {
 if (sameString(fileName, "stdin"))
     return STDIN_FILENO;
 if (sameString(fileName, "stdout"))
     return STDOUT_FILENO;
 // mode is necessary when O_CREAT is given, ignored otherwise
-int mode = 00664;
+int mode = 0666;
 int fd = open(fileName, flags, mode);
 if (fd < 0)
     {
     char *modeName = "";
     if ((flags & (O_WRONLY | O_CREAT | O_TRUNC)) == (O_WRONLY | O_CREAT | O_TRUNC))
 	modeName = " to create and truncate";
     else if ((flags & (O_WRONLY | O_CREAT)) == (O_WRONLY | O_CREAT))
 	modeName = " to create";
     else if ((flags & O_WRONLY) == O_WRONLY)
 	modeName = " to write";
     else if ((flags & O_RDWR) == O_RDWR)
 	modeName = " to append";
     else
 	modeName = " to read";
     errnoAbort("mustOpenFd: Can't open %s%s", fileName, modeName);