[haiku-bugs] Re: [Haiku] #5520: IsWritable / IsReadable methods do not currently check Write/Read mode bits.

  • From: "stippi" <trac@xxxxxxxxxxxx>
  • Date: Wed, 03 Mar 2010 13:57:52 -0000

#5520: IsWritable / IsReadable methods do not currently check Write/Read mode
bits.
-------------------------------+--------------------------------------------
  Reporter:  ver               |       Owner:  axeld                      
      Type:  enhancement       |      Status:  closed                     
  Priority:  normal            |   Milestone:  R1                         
 Component:  Kits/Storage Kit  |     Version:  R1/Development             
Resolution:  invalid           |    Keywords:  IsWritable IsReadable BFile
 Blockedby:                    |    Platform:  All                        
  Blocking:                    |  
-------------------------------+--------------------------------------------

Comment(by stippi):

 ver, what you seem to be missing, and what the other commenters write
 between the lines only (unless I overlooked it), is that the open mode of
 a BFile object cannot change. You create a new BFile object, or you call
 SetTo() on an existing BFile object. In both cases, you have to provide
 the open mode. What you seem to be missing is that this operation will
 simply fail if the desired open mode is not allowed. You cannot create
 BFile with B_READ_FILE | B_WRITE_FILE, have it succeed and in reality, the
 file is only readable. Instead, SetTo() or InitCheck() will return an
 error code, and you just cannot use the object. That's why there is no
 problem with IsWritable() and IsReadable() at all, since the mode cannot
 change after construction or SetTo(). The usecase you pointed out with the
 user changing permissions of the file makes no sense, since StyledEdit for
 example would have to reopen the file internally, for any changes to take
 affect, it won't have an affect on already open BFile objects.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/5520#comment:7>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: