4
我試圖使用打開( 「/ tmp目錄」,O_RDWR O_TMPFILE,0)與權限被拒絕
fd = open("/tmp", O_RDWR | O_TMPFILE, 0);
if (fd == -1) {
perror("open()");
exit(1);
}
打開一個臨時文件和我正在失敗。
我在/ tmp目錄權限:
drwxrwxrwt 13 root root 1.2K Apr 23 13:55 /tmp/
,我相信我的內核是新的足夠O_TMPFILE:
Linux frosties 3.14-1-amd64 #1 SMP Debian 3.14.2-1 (2014-04-28) x86_64 GNU/Linux
我缺少什麼?
O_TMPFILE獲取目錄路徑。創建文件沒有名稱。使用「/tmp/tmpfile.txt」導致「沒有這樣的文件或目錄」,因爲它不存在。 –
並非所有的文件系統都支持O_TMPFILE標誌。你在/ tmp下掛載了哪一個? – kofemann
@naltipar請仔細閱讀問題中的ls輸出。 –