nspawn: use access/F_OK instead of stat to check for file existence
This commit is contained in:
parent
2094cd49c4
commit
eafc7d6056
|
@ -587,7 +587,6 @@ int mount_all(const char *dest,
|
||||||
for (k = 0; k < ELEMENTSOF(mount_table); k++) {
|
for (k = 0; k < ELEMENTSOF(mount_table); k++) {
|
||||||
_cleanup_free_ char *where = NULL, *options = NULL;
|
_cleanup_free_ char *where = NULL, *options = NULL;
|
||||||
const char *o;
|
const char *o;
|
||||||
struct stat source_st;
|
|
||||||
bool fatal = FLAGS_SET(mount_table[k].mount_settings, MOUNT_FATAL);
|
bool fatal = FLAGS_SET(mount_table[k].mount_settings, MOUNT_FATAL);
|
||||||
|
|
||||||
if (in_userns != FLAGS_SET(mount_table[k].mount_settings, MOUNT_IN_USERNS))
|
if (in_userns != FLAGS_SET(mount_table[k].mount_settings, MOUNT_IN_USERNS))
|
||||||
|
@ -617,7 +616,7 @@ int mount_all(const char *dest,
|
||||||
/* Shortcut for optional bind mounts: if the source can't be found skip ahead to avoid creating
|
/* Shortcut for optional bind mounts: if the source can't be found skip ahead to avoid creating
|
||||||
* empty and unused directories. */
|
* empty and unused directories. */
|
||||||
if (!fatal && FLAGS_SET(mount_table[k].mount_settings, MOUNT_MKDIR) && FLAGS_SET(mount_table[k].flags, MS_BIND)) {
|
if (!fatal && FLAGS_SET(mount_table[k].mount_settings, MOUNT_MKDIR) && FLAGS_SET(mount_table[k].flags, MS_BIND)) {
|
||||||
r = stat(mount_table[k].what, &source_st);
|
r = access(mount_table[k].what, F_OK);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue