If the file pointer is NULL, you shouldn't do fclose on it. It will cause undefined behavior.
It might crash or harm current loaded memory on old systems.
/**
* @file file_open_error_msg.c
*
* @brief This file is used to show some information about file permissions when yiffy is not able to read file.
*
* @author Mehmet Mert Gunduz (merttgg@gmail.com)
*
* @date 05/08/2023
*/
#include "yiffy_messages.h"
/**
* @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)
{
fprintf(stderr, "yiffy: error opening the file.\n");
fprintf(stderr, "yiffy: please check the file read-write permissions.\n");
fclose(file);
}
The FILE *file parameter and fclose function should be removed from the code.
After removing the code files using this function should be fixed.
/src/msg/file_open_error_msg.c needs bugfix.
If the file pointer is NULL, you shouldn't do fclose on it. It will cause undefined behavior.
It might crash or harm current loaded memory on old systems.
The FILE *file parameter and fclose function should be removed from the code.
After removing the code files using this function should be fixed.