[Development] [QLockFile] Whether it is reasonable to use 0644 permission ?

Thiago Macieira thiago.macieira at intel.com
Wed Jul 27 23:23:08 CEST 2016


On quarta-feira, 27 de julho de 2016 22:15:45 PDT Kevin Kofler wrote:
> Thiago Macieira wrote:
> > If you don't have permission to delete it, then you're going to have a
> > problem to drop your own lock if you steal the lock by writing to the
> > file.
> 
> So this means that the permission should be 0644 to prevent that from
> happening. Thus, I don't understand how you get to:

The permission of the file is irrelevant. The permission of the dir is the one 
that matters.

> > Either way, the mode in the call should be 0666.

Because that will result in 0644 or 0664, depending on the user's umask. The 
correct modes for creat() and open() should be only 0600, 0700, 0666 and 0777. 
Anything else is suspicious and probably wrong. Like this case.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list