linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* O_CREAT|O_DIRECTORY on nonexisting file with ext4 not posix-compliant
@ 2014-12-15 17:39 Fiedler Roman
  2014-12-16  2:49 ` NeilBrown
  0 siblings, 1 reply; 5+ messages in thread
From: Fiedler Roman @ 2014-12-15 17:39 UTC (permalink / raw)
  To: linux-fsdevel@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

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.

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@ait.ac.at | http://www.ait.ac.at/

FN: 115980 i HG Wien  |  UID: ATU14703506
http://www.ait.ac.at/Email-Disclaimer


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6344 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-16 21:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-15 17:39 O_CREAT|O_DIRECTORY on nonexisting file with ext4 not posix-compliant Fiedler Roman
2014-12-16  2:49 ` NeilBrown
2014-12-16 10:42   ` AW: " Fiedler Roman
2014-12-16 21:43     ` NeilBrown
2014-12-16 16:36   ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).