Wrong place to close hosts file
This commit is contained in:
parent
fea10c2d6e
commit
91c01dd192
4
main.c
4
main.c
@ -71,14 +71,14 @@ void modifyHostsFile(char *oldhost, char *newhost, int deleteHost) {
|
|||||||
|
|
||||||
// // Seek to 0
|
// // Seek to 0
|
||||||
fseek(hostsFile, 0, SEEK_SET);
|
fseek(hostsFile, 0, SEEK_SET);
|
||||||
fclose(hostsFile);
|
// fclose(hostsFile);
|
||||||
|
|
||||||
// If this failed, write an error message to stderr
|
// If this failed, write an error message to stderr
|
||||||
ONFAILED(0, (fwrite(newHostsFile, sizeof(char), sizeof(newHostsFile), hostsFile))) {
|
ONFAILED(0, (fwrite(newHostsFile, sizeof(char), sizeof(newHostsFile), hostsFile))) {
|
||||||
fprintf(stderr, "Did not write anything!\n");
|
fprintf(stderr, "Did not write anything!\n");
|
||||||
}
|
}
|
||||||
fprintf(stderr, "New hosts file: \n%s\n", newHostsFile);
|
fprintf(stderr, "New hosts file: \n%s\n", newHostsFile);
|
||||||
// fclose(hostsFile);
|
fclose(hostsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user