mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-24 15:02:44 +00:00
policycoreutils: make ignore_enoent do something
We have dumb code in setfiles which will set a static variable called ignore_enoent. Thing is, nothing uses it. So move the setting to where it is useful and use it! Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
84ea17b5f3
commit
30ad11feb9
@ -374,6 +374,8 @@ int process_one_realpath(char *name, int recurse)
|
||||
} else {
|
||||
rc = lstat(name, &sb);
|
||||
if (rc < 0) {
|
||||
if (r_opts->ignore_enoent && errno == ENOENT)
|
||||
return 0;
|
||||
fprintf(stderr, "%s: lstat(%s) failed: %s\n",
|
||||
r_opts->progname, name, strerror(errno));
|
||||
return -1;
|
||||
|
@ -27,6 +27,7 @@ struct restore_opts {
|
||||
int hard_links;
|
||||
int verbose;
|
||||
int logging;
|
||||
int ignore_enoent;
|
||||
char *rootpath;
|
||||
int rootpathlen;
|
||||
char *progname;
|
||||
|
@ -25,7 +25,6 @@ static char *policyfile = NULL;
|
||||
static int warn_no_match = 0;
|
||||
static int null_terminated = 0;
|
||||
static int errors;
|
||||
static int ignore_enoent;
|
||||
static struct restore_opts r_opts;
|
||||
|
||||
#define STAT_BLOCK_SIZE 1
|
||||
@ -335,7 +334,7 @@ int main(int argc, char **argv)
|
||||
r_opts.debug = 1;
|
||||
break;
|
||||
case 'i':
|
||||
ignore_enoent = 1;
|
||||
r_opts.ignore_enoent = 1;
|
||||
break;
|
||||
case 'l':
|
||||
r_opts.logging = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user