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 {
|
} else {
|
||||||
rc = lstat(name, &sb);
|
rc = lstat(name, &sb);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
if (r_opts->ignore_enoent && errno == ENOENT)
|
||||||
|
return 0;
|
||||||
fprintf(stderr, "%s: lstat(%s) failed: %s\n",
|
fprintf(stderr, "%s: lstat(%s) failed: %s\n",
|
||||||
r_opts->progname, name, strerror(errno));
|
r_opts->progname, name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -27,6 +27,7 @@ struct restore_opts {
|
||||||
int hard_links;
|
int hard_links;
|
||||||
int verbose;
|
int verbose;
|
||||||
int logging;
|
int logging;
|
||||||
|
int ignore_enoent;
|
||||||
char *rootpath;
|
char *rootpath;
|
||||||
int rootpathlen;
|
int rootpathlen;
|
||||||
char *progname;
|
char *progname;
|
||||||
|
|
|
@ -25,7 +25,6 @@ static char *policyfile = NULL;
|
||||||
static int warn_no_match = 0;
|
static int warn_no_match = 0;
|
||||||
static int null_terminated = 0;
|
static int null_terminated = 0;
|
||||||
static int errors;
|
static int errors;
|
||||||
static int ignore_enoent;
|
|
||||||
static struct restore_opts r_opts;
|
static struct restore_opts r_opts;
|
||||||
|
|
||||||
#define STAT_BLOCK_SIZE 1
|
#define STAT_BLOCK_SIZE 1
|
||||||
|
@ -335,7 +334,7 @@ int main(int argc, char **argv)
|
||||||
r_opts.debug = 1;
|
r_opts.debug = 1;
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
ignore_enoent = 1;
|
r_opts.ignore_enoent = 1;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
r_opts.logging = 1;
|
r_opts.logging = 1;
|
||||||
|
|
Loading…
Reference in New Issue