dns_conf: fix relative path issue
This commit is contained in:
11
src/util.c
11
src/util.c
@@ -29,6 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <libgen.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/netlink.h>
|
||||
@@ -109,6 +110,16 @@ unsigned long get_tick_count(void)
|
||||
return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
|
||||
}
|
||||
|
||||
char *dir_name(char *path)
|
||||
{
|
||||
if (strstr(path, "/") == NULL) {
|
||||
safe_strncpy(path, "./", PATH_MAX);
|
||||
return path;
|
||||
}
|
||||
|
||||
return dirname(path);
|
||||
}
|
||||
|
||||
char *get_host_by_addr(char *host, int maxsize, struct sockaddr *addr)
|
||||
{
|
||||
struct sockaddr_storage *addr_store = (struct sockaddr_storage *)addr;
|
||||
|
||||
Reference in New Issue
Block a user