filecopy: fix handling ENOENT error
Do not fail when file was successfully created. I will test before commit. I will test before commit. I will...
This commit is contained in:
parent
d6eb7e5c58
commit
bbdb5ed67f
@ -109,12 +109,14 @@ void process_one_file_reg(struct file_header *untrusted_hdr,
|
|||||||
/* make the file inaccessible until fully written */
|
/* make the file inaccessible until fully written */
|
||||||
if (use_tmpfile) {
|
if (use_tmpfile) {
|
||||||
fdout = open(".", O_WRONLY | O_TMPFILE, 0700);
|
fdout = open(".", O_WRONLY | O_TMPFILE, 0700);
|
||||||
if (fdout < 0 && errno==ENOENT) {
|
if (fdout < 0) {
|
||||||
|
if (errno==ENOENT)
|
||||||
/* if it fails, do not attempt further use - most likely kernel too old */
|
/* if it fails, do not attempt further use - most likely kernel too old */
|
||||||
use_tmpfile = 0;
|
use_tmpfile = 0;
|
||||||
} else
|
else
|
||||||
do_exit(errno, untrusted_name);
|
do_exit(errno, untrusted_name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (fdout < 0)
|
if (fdout < 0)
|
||||||
fdout = open(untrusted_name, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW, 0000); /* safe because of chroot */
|
fdout = open(untrusted_name, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW, 0000); /* safe because of chroot */
|
||||||
if (fdout < 0)
|
if (fdout < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user