Use execv to cat out hosts list to see who's been blocked.

This commit is contained in:
Jacob Windle 2019-02-28 19:25:58 -05:00
parent 7c0f494f40
commit 258e2c8de3

9
main.c
View File

@ -46,13 +46,12 @@ void showHosts()
{
pid_t child = fork();
int rc = 0;
char * argv[] = {
"/etc/hosts"
};
char *const parmList[] = {"/bin/cat", "/etc/hosts", NULL};
if (child == 0)
{
execv("/bin/cat", argv);
execv("/bin/cat", parmList);
}
else
{
@ -88,7 +87,7 @@ int main(int argc, char **argv)
usage();
exit(0);
}
else
else if (strcmp(argv[i], "show") == 0)
{
showHosts();
}