提交 42705674 编写于 作者: R Roberto Sassu

Evaluate correct stat in compact/unknown generators

上级 24f1ee1a
......@@ -249,7 +249,7 @@ int generator(int dirfd, int pos, struct list_head *head_in,
LIST_HEAD(list_head);
FTS *fts = NULL;
FTSENT *ftsent;
struct stat st;
struct stat st, *statp;
void *data;
loff_t size;
bool unlink = true;
......@@ -415,6 +415,9 @@ int generator(int dirfd, int pos, struct list_head *head_in,
switch (ftsent->fts_info) {
case FTS_F:
include_file = 0;
statp = ftsent->fts_statp;
if (path_list_ext)
statp = &st;
if (include_path && only_executables) {
list_for_each_entry(cur_i, head_in,
......@@ -435,7 +438,7 @@ int generator(int dirfd, int pos, struct list_head *head_in,
}
if (only_executables &&
(ftsent->fts_statp->st_mode & S_IXUGO))
(statp->st_mode & S_IXUGO))
include_file = 1;
if (!include_file)
......@@ -457,9 +460,7 @@ int generator(int dirfd, int pos, struct list_head *head_in,
continue;
ret = add_file(dirfd, fd, ftsent->fts_path,
type, modifiers,
path_list_ext ? &st :
ftsent->fts_statp, list,
type, modifiers, statp, list,
list_file, algo, ima_algo, tlv,
gen_list_path != NULL,
include_lsm_label, root_cred,
......
......@@ -248,7 +248,7 @@ int generator(int dirfd, int pos, struct list_head *head_in,
time_t t = time(NULL);
bool unlink = true;
struct tm tm;
struct stat st;
struct stat st, *statp;
LIST_HEAD(list_head);
char *attrs[ATTR__LAST];
struct passwd *pwd;
......@@ -418,6 +418,9 @@ int generator(int dirfd, int pos, struct list_head *head_in,
switch (ftsent->fts_info) {
case FTS_F:
include_file = 0;
statp = ftsent->fts_statp;
if (path_list_ext)
statp = &st;
if (include_path && only_executables) {
list_for_each_entry(cur_i, head_in,
......@@ -438,7 +441,7 @@ int generator(int dirfd, int pos, struct list_head *head_in,
}
if (only_executables &&
(ftsent->fts_statp->st_mode & S_IXUGO))
(statp->st_mode & S_IXUGO))
include_file = 1;
if (!include_file)
......@@ -460,8 +463,7 @@ int generator(int dirfd, int pos, struct list_head *head_in,
continue;
ret = add_file(dirfd, fd, ftsent->fts_path,
type, modifiers, path_list_ext ?
&st : ftsent->fts_statp,
type, modifiers, statp,
list, list_file, algo, ima_algo, tlv,
gen_list_path != NULL,
include_lsm_label, root_cred, set_ima_xattr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册