Re: O_CREAT|O_DIRECTORY on nonexisting file with ext4 not posix-compliant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 Dec 2014 17:39:09 +0000 Fiedler Roman <Roman.Fiedler@xxxxxxxxx>
wrote:

> Hi,
> 
> It seems that the open syscall is not POSIX-compliant when using both
> O_CREAT|O_DIRECTORY. This was discussed in [1] with a reference to the POSIX
> documentation.

Given that O_DIRECTORY is not part of POSIX, I don't think that
POSIX-compliance is an issue here.

However the implementation does seem to differ from the Linux documentation.

I suggest you submit a patch to the manpages project to change

  If  pathname  is  not a directory

to

  If  pathname exists and is  not a directory

That should fix the problem.

NeilBrown


> 
> A simple test program is:
> 
> #include <fcntl.h>
> #include <stdio.h>
> #include <sys/stat.h>
> 
> int main(int argc, char **argv) {
>   int fd;
>   struct stat statBuf;
>   int result;
> 
>   fd=open("xxx", O_RDWR|O_CREAT|O_DIRECTORY, 0600);
>   result=fstat(fd, &statBuf);
>   if(result) {
>     fprintf(stderr, "Stat failed\n");
>     return(1);
>   }
>   fprintf(stderr, "New element type is %d\n", S_ISDIR(statBuf.st_mode));
>   return(0);
> }
> 
> 
> Kind Regards,
> Roman
> 
> [1] http://www.openwall.com/lists/oss-security/2014/11/26/10
> 
> 
> DI Roman Fiedler
> Scientist
> Digital Safety & Security Department
> Assistive Healthcare Information Technology
> 
> AIT Austrian Institute of Technology GmbH
> Reininghausstraße 13/1 | 8020 Graz | Austria
> T +43(0) 50550 2957 | M +43(0) 664 8561599 | F +43(0) 50550 2950
> roman.fiedler@xxxxxxxxx | http://www.ait.ac.at/
> 
> FN: 115980 i HG Wien  |  UID: ATU14703506
> http://www.ait.ac.at/Email-Disclaimer
> 

Attachment: pgpYhIsAhFU8k.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux