mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-18 06:51:54 +00:00
Fix check_file_readability function
Thanks to Martin Mares for warning.
This commit is contained in:
parent
695f704389
commit
2f0660544b
@ -10,7 +10,7 @@ CF_HDR
|
|||||||
|
|
||||||
#define PARSER 1
|
#define PARSER 1
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "nest/bird.h"
|
#include "nest/bird.h"
|
||||||
#include "conf/conf.h"
|
#include "conf/conf.h"
|
||||||
@ -45,8 +45,11 @@ check_u16(unsigned val)
|
|||||||
static void
|
static void
|
||||||
check_file_readability(const char *file_path)
|
check_file_readability(const char *file_path)
|
||||||
{
|
{
|
||||||
if(access(file_path, R_OK) == -1)
|
FILE *file = fopen(file_path, "r");
|
||||||
cf_error("File %s cannot be open for read: %m", file_path);
|
if (file)
|
||||||
|
fclose(file);
|
||||||
|
else
|
||||||
|
cf_error("File '%s' cannot be open for read: %m", file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
CF_DECLS
|
CF_DECLS
|
||||||
|
Loading…
Reference in New Issue
Block a user