I'm trying to open a tempfile using
fd = open("/tmp", O_RDWR | O_TMPFILE, 0);
if (fd == -1) {
perror("open()");
exit(1);
}
and I am getting "open(): Permission denied".
I have permissions in /tmp:
drwxrwxrwt 13 root root 1.2K Apr 23 13:55 /tmp/
and I believe my kernel is new enough for O_TMPFILE:
Linux frosties 3.14-1-amd64 #1 SMP Debian 3.14.2-1 (2014-04-28) x86_64 GNU/Linux
What am I missing?
The call failed because you have specified mode 0
, which means no permissions. See this LWN article for a discussion of this behavior of the Linux kernel, and an apparent bugfix.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.