mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-08-03 18:05:58 -04:00
containerfs: convert char devices(0, 0) to whiteout
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
7bbfb5b479
commit
54d1c2157f
18
main.c
18
main.c
@ -46,6 +46,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <fts.h>
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
#include <sys/xattr.h>
|
||||
|
||||
@ -577,7 +578,9 @@ traverse_dir (char * const dir, struct lo_node *lower, bool low)
|
||||
struct lo_node *root, *n, *parent;
|
||||
int ret = -1;
|
||||
char *const dirs[] = {dir, NULL};
|
||||
FTS *fts = fts_open (dirs, FTS_NOSTAT | FTS_COMFOLLOW, NULL);
|
||||
const char *name;
|
||||
char tmp[PATH_MAX + 4];
|
||||
FTS *fts = fts_open (dirs, FTS_COMFOLLOW, NULL);
|
||||
if (fts == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -624,7 +627,18 @@ traverse_dir (char * const dir, struct lo_node *lower, bool low)
|
||||
case FTS_SL:
|
||||
case FTS_SLNONE:
|
||||
case FTS_DEFAULT:
|
||||
n = make_lo_node (ent->fts_path, ent->fts_name, false);
|
||||
name = ent->fts_name;
|
||||
if ((ent->fts_statp->st_mode & S_IFMT) == S_IFCHR)
|
||||
{
|
||||
if (major (ent->fts_statp->st_rdev) == 0
|
||||
&& minor (ent->fts_statp->st_rdev) == 0)
|
||||
{
|
||||
sprintf (tmp, ".wh.%s", ent->fts_name);
|
||||
name = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
n = make_lo_node (ent->fts_path, name, false);
|
||||
if (n == NULL)
|
||||
goto err;
|
||||
n->low = low ? 1 : 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user