Mail Archives: cygwin/2001/09/25/15:11:45
This may have a rather obvious answer, but I can't figure it:
Does anyone know why the following code creates a file with read/write
permissions, instead of only read permissions?
-----------------------------
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
int main(int argc, char* argv[])
{
int openflag = (O_BINARY | O_CREAT | O_EXCL | O_WRONLY);
mode_t mode = 0x124;
int fd = open ("delme.txt", openflag, mode);
printf("fd = %d\n", fd);
mode_t mask = umask(0);
umask(mask);
printf("umask = %d\n", mask);
}
-----------------------------
... then .. ls -l delme.txt gives:
-rw-r--r-- 1 administ None 0 Sep 25 14:40 delme.txt
My umask is 0. I can chmod on the file to anything I want.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -