filecopy: fallback to "open(..., 000)" method when /proc inaccessible

/proc is needed to link files opened with O_TMPFILE to the filesystem.
If not available, fallback to using permissions to block file access,
instead of failing the whole file copy.
This commit is contained in:
Marek Marczykowski-Górecki 2015-01-29 00:44:38 +01:00
parent efb79d5784
commit 9f51c82666

View File

@ -71,9 +71,10 @@ int main(int argc __attribute((__unused__)), char ** argv __attribute__((__unuse
}
procfs_fd = open(procdir_path, O_DIRECTORY | O_RDONLY);
if (procfs_fd < 0)
gui_fatal("Failed to open /proc");
perror("Failed to open /proc");
else
set_procfs_fd(procfs_fd);
free(procdir_path);
set_procfs_fd(procfs_fd);
if (chroot("."))
gui_fatal("Error chroot to %s", incoming_dir);