Skip to content

Commit

Permalink
message function file closing fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetmertguduz committed May 12, 2024
1 parent 075b47f commit 1159746
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/conf/conf_nsfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void conf_nsfw(char *argv)

if (conf_read_write_file == NULL)
{
file_open_error_msg(conf_read_write_file);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand Down Expand Up @@ -85,7 +85,7 @@ void conf_nsfw(char *argv)

if (conf_append_file == NULL)
{
file_open_error_msg(conf_append_file);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand All @@ -105,7 +105,7 @@ void conf_nsfw(char *argv)

if (conf_write_file == NULL)
{
file_open_error_msg(conf_write_file);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand Down
6 changes: 3 additions & 3 deletions src/conf/conf_plog.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void conf_plog(char *argv)

if (conf_read_write_file == NULL)
{
file_open_error_msg(conf_read_write_file);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand Down Expand Up @@ -85,7 +85,7 @@ void conf_plog(char *argv)

if (conf_append_file == NULL)
{
file_open_error_msg(conf_append_file);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand All @@ -105,7 +105,7 @@ void conf_plog(char *argv)

if (conf_write_file == NULL)
{
file_open_error_msg(conf_write_file);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fetch/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void fetch(char *tags, int page, char *command)

if (config == NULL)
{
file_open_error_msg(config);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand Down
2 changes: 1 addition & 1 deletion src/menus/show_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void show_config()

if (config_file == NULL)
{
file_open_error_msg(config_file);
file_open_error_msg();
exit(EXIT_FAILURE);
}

Expand Down
6 changes: 1 addition & 5 deletions src/msg/file_open_error_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@

/**
* @brief Shows some information about file permissions when yiffy is not able to read file.
*
* @param file This is used to close the file.
*/
void file_open_error_msg(FILE *file)
void file_open_error_msg()
{
fprintf(stderr, "yiffy: error opening the file.\n");
fprintf(stderr, "yiffy: please check the file read-write permissions.\n");

fclose(file);
}
2 changes: 1 addition & 1 deletion src/msg/yiffy_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void no_arg_value_msg(char *argument);
void argc_error_msg(int argc);
void extra_arg_error_msg(char *argument);
void no_home_error_msg();
void file_open_error_msg(FILE *file);
void file_open_error_msg();
void no_json_error_msg(FILE *json_file);
void json_parse_error_msg();
void no_results_error_msg();
Expand Down

0 comments on commit 1159746

Please sign in to comment.