Check if QubesIncoming filesystem supports O_TMPFILE

The filesystem hosting ~/QubesIncoming/srcVM/ needs to support O_TMPFILE
too, in addition to the kernel. If it doesn't, take the use_tmpfile = 0
fallback.

(cherry picked from commit 74a1b4cc50)
This commit is contained in:
Rusty Bird 2015-11-11 11:35:16 +00:00 committed by Marek Marczykowski-Górecki
parent 6fcc66eae4
commit c78b2c3a7a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -112,11 +112,11 @@ void process_one_file_reg(struct file_header *untrusted_hdr,
if (use_tmpfile) {
fdout = open(".", O_WRONLY | O_TMPFILE, 0700);
if (fdout < 0) {
if (errno==ENOENT)
/* if it fails, do not attempt further use - most likely kernel too old */
use_tmpfile = 0;
else
do_exit(errno, untrusted_name);
if (errno==ENOENT || /* most likely, kernel too old for O_TMPFILE */
errno==EOPNOTSUPP) /* filesystem has no support for O_TMPFILE */
use_tmpfile = 0;
else
do_exit(errno, untrusted_name);
}
}
if (fdout < 0)