version 1.74, 2023/07/19 13:26:20 |
version 1.74.2.1, 2023/11/20 17:56:22 |
|
|
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <getopt.h> |
#include <getopt.h> |
|
#include <libgen.h> |
#include <limits.h> |
#include <limits.h> |
#include <paths.h> |
#include <paths.h> |
#include <stdio.h> |
#include <stdio.h> |
|
|
perror("unveil"); |
perror("unveil"); |
my_exit(2); |
my_exit(2); |
} |
} |
if (filearg[0] != NULL) |
if (filearg[0] != NULL) { |
|
char *origdir; |
|
|
if (unveil(filearg[0], "rwc") == -1) { |
if (unveil(filearg[0], "rwc") == -1) { |
perror("unveil"); |
perror("unveil"); |
my_exit(2); |
my_exit(2); |
} |
} |
|
if ((origdir = dirname(filearg[0])) == NULL) { |
|
perror("dirname"); |
|
my_exit(2); |
|
} |
|
if (unveil(origdir, "rwc") == -1) { |
|
perror("unveil"); |
|
my_exit(2); |
|
} |
|
} else { |
|
if (unveil(".", "rwc") == -1) { |
|
perror("unveil"); |
|
my_exit(2); |
|
} |
|
} |
if (filearg[1] != NULL) |
if (filearg[1] != NULL) |
if (unveil(filearg[1], "r") == -1) { |
if (unveil(filearg[1], "r") == -1) { |
perror("unveil"); |
perror("unveil"); |
|
|
perror("unveil"); |
perror("unveil"); |
my_exit(2); |
my_exit(2); |
} |
} |
if (unveil(".", "rwc") == -1) { |
|
perror("unveil"); |
|
my_exit(2); |
|
} |
|
if (*rejname != '\0') |
if (*rejname != '\0') |
if (unveil(rejname, "rwc") == -1) { |
if (unveil(rejname, "rwc") == -1) { |
perror("unveil"); |
perror("unveil"); |