java.io/202: File creation doesn't observe umask

Bryce McKinlay bryce@albatross.co.nz
Sat Apr 15 19:20:00 GMT 2000


The following reply was made to PR java.io/202; it has been noted by GNATS.

From: Bryce McKinlay <bryce@albatross.co.nz>
To: jsturm@sigma6.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: java.io/202: File creation doesn't observe umask
Date: Sun, 16 Apr 2000 14:20:20 +1200

 This is a multi-part message in MIME format.
 --------------D5D26A045441CB02CA8A32E2
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 jsturm@sigma6.com wrote:
 
 > Classes that create OS files (i.e. java.io.FileOutputStream)
 > do not obey the user's current umask.  Files are always
 > created with permissions -rw-r--r-- regardless of the user's
 > umask setting.
 
 umask is being honored, but we're creating files with the wrong mode (so
 changing umask from 022 to 000 appears to have no effect). The following patch
 should fix that. OK to commit?
 
 regards
 
   [ bryce ]
 
 
 
 --------------D5D26A045441CB02CA8A32E2
 Content-Type: text/plain; charset=us-ascii;
  name="filedescriptor-umask.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="filedescriptor-umask.patch"
 
 2000-04-16  Bryce McKinlay  <bryce@albatross.co.nz>
 
         * java/io/natFileDescriptorPosix.cc (open): Use mode 0666. Fix for PR
         libgcj/202.
         (available): Initialize `where' to prevent bogus compiler warning.
 
 Index: libjava/java/io/natFileDescriptorPosix.cc
 ===================================================================
 RCS file: /cvs/java/libgcj/libjava/java/io/natFileDescriptorPosix.cc,v
 retrieving revision 1.7
 diff -u -r1.7 natFileDescriptorPosix.cc
 --- natFileDescriptorPosix.cc	2000/03/07 19:55:26	1.7
 +++ natFileDescriptorPosix.cc	2000/04/16 02:14:16
 @@ -83,7 +83,7 @@
  #endif
  
    JvAssert ((jflags & READ) || (jflags & WRITE));
 -  int mode = 0644;
 +  int mode = 0666;
    if ((jflags & READ) && (jflags & WRITE))
      flags |= O_RDWR;
    else if ((jflags & READ))
 @@ -281,7 +281,7 @@
    if (! num_set)
      {
        struct stat sb;
 -      off_t where;
 +      off_t where = 0;
        if (fstat (fd, &sb) != -1
  	  && S_ISREG (sb.st_mode)
  	  && (where = lseek (fd, SEEK_CUR, 0)) != (off_t) -1)
 
 --------------D5D26A045441CB02CA8A32E2--
 


More information about the Java-prs mailing list