From 91c01dd1920b6a1e5977627d5dc290c4ba9b9205 Mon Sep 17 00:00:00 2001 From: Jacob Date: Sat, 18 Jan 2020 07:43:02 -0500 Subject: [PATCH] Wrong place to close hosts file --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 354a13a..7dd0129 100644 --- a/main.c +++ b/main.c @@ -71,14 +71,14 @@ void modifyHostsFile(char *oldhost, char *newhost, int deleteHost) { // // Seek to 0 fseek(hostsFile, 0, SEEK_SET); - fclose(hostsFile); +// fclose(hostsFile); // If this failed, write an error message to stderr ONFAILED(0, (fwrite(newHostsFile, sizeof(char), sizeof(newHostsFile), hostsFile))) { fprintf(stderr, "Did not write anything!\n"); } fprintf(stderr, "New hosts file: \n%s\n", newHostsFile); -// fclose(hostsFile); + fclose(hostsFile); }