mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-13 01:09:41 -04:00
Merge pull request #272 from giuseppe/check-whiteout-already-exists
main: check if whiteout device already exists
This commit is contained in:
commit
b104426786
15
main.c
15
main.c
@ -733,6 +733,21 @@ create_whiteout (struct ovl_data *lo, struct ovl_node *parent, const char *name,
|
|||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (errno == EEXIST)
|
||||||
|
{
|
||||||
|
int saved_errno = errno;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
/* Check whether it is already a whiteout. */
|
||||||
|
if (TEMP_FAILURE_RETRY (fstatat (get_upper_layer (lo)->fd, whiteout_path, &st, AT_SYMLINK_NOFOLLOW)) == 0
|
||||||
|
&& (st.st_mode & S_IFMT) == S_IFCHR
|
||||||
|
&& major (st.st_rdev) == 0
|
||||||
|
&& minor (st.st_rdev) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
errno = saved_errno;
|
||||||
|
}
|
||||||
|
|
||||||
if (errno != EPERM && errno != ENOTSUP)
|
if (errno != EPERM && errno != ENOTSUP)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user