@@ -394,6 +394,7 @@ int main(int argc, char **argv)
char *name;
int state;
struct policy_file pf;
+ char *pf_name;
if (argc <= 1)
usage(argv[0], 1);
@@ -401,23 +402,24 @@ int main(int argc, char **argv)
usage(argv[0], 0);
else if (argc != 2)
usage(argv[0], 1);
+ pf_name = argv[1];
- fd = open(argv[1], O_RDONLY);
+ fd = open(pf_name, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "Can't open '%s': %s\n",
- argv[1], strerror(errno));
+ pf_name, strerror(errno));
exit(1);
}
if (fstat(fd, &sb) < 0) {
fprintf(stderr, "Can't stat '%s': %s\n",
- argv[1], strerror(errno));
+ pf_name, strerror(errno));
exit(1);
}
map =
mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (map == MAP_FAILED) {
fprintf(stderr, "Can't map '%s': %s\n",
- argv[1], strerror(errno));
+ pf_name, strerror(errno));
exit(1);
}
Signed-off-by: Masatake YAMATO <yamato@redhat.com> --- checkpolicy/test/dispol.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)