oss-sec mailing list archives
Re: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour?
From: Matthew Daley <mattd () bugfuzz com>
Date: Thu, 27 Nov 2014 08:28:14 +1300
On Thu, Nov 27, 2014 at 4:28 AM, Fiedler Roman <Roman.Fiedler () ait ac at> wrote:
(...) My test program was: #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(fd));
FWIW, this should probably be S_ISDIR(statBuf.st_mode). - Matthew
return(0); }
Current thread:
- O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Fiedler Roman (Nov 26)
- Re: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Eric Blake (Nov 26)
- AW: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Fiedler Roman (Nov 26)
- Re: AW: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Daniel Kahn Gillmor (Nov 26)
- Re: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Matthew Daley (Nov 26)
- AW: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Fiedler Roman (Nov 26)
- Re: AW: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Andy Lutomirski (Dec 01)
- AW: Re: AW: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Fiedler Roman (Dec 15)
- AW: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Fiedler Roman (Nov 26)
- Re: O_CREAT|O_DIRECTORY on nonexisting file expected behaviour? Eric Blake (Nov 26)