25#ifndef SURICATA_UTIL_PATH_H
26#define SURICATA_UTIL_PATH_H
29typedef struct _stat
SCStat;
30#define SCFstatFn(fd, statbuf) _fstat((fd), (statbuf))
31#define SCStatFn(pathname, statbuf) _stat((pathname), (statbuf))
34#define SCFstatFn(fd, statbuf) fstat((fd), (statbuf))
35#define SCStatFn(pathname, statbuf) stat((pathname), (statbuf))
38#if defined OS_WIN32 || defined __CYGWIN__
39#define PATH_SEPARATOR_SIZE 2
41#define PATH_SEPARATOR_SIZE 1
44#ifndef HAVE_NON_POSIX_MKDIR
45 #define SCMkDir(a, b) mkdir(a, b)
47 #define SCMkDir(a, b) mkdir(a)
52int PathMerge(
char *out_buf,
size_t buf_size,
const char *
const dir,
const char *
const fname);
53char *
PathMergeAlloc(
const char *
const dir,
const char *
const fname);
59char *
SCRealPath(
const char *path,
char *resolved_path);
int PathMerge(char *out_buf, size_t buf_size, const char *const dir, const char *const fname)
char * SCRealPath(const char *path, char *resolved_path)
OS independent wrapper for realpath.
bool SCPathContainsTraversal(const char *path)
Check for directory traversal.
bool SCPathExists(const char *path)
Check if a path exists.
char * PathMergeAlloc(const char *const dir, const char *const fname)
bool SCIsRegularDirectory(const struct dirent *const dir_entry)
OS independent wrapper for directory check.
bool SCIsRegularFile(const struct dirent *const dir_entry)
OS independent to check for regular file.
int SCCreateDirectoryTree(const char *path, const bool final)
Recursively create a directory.
int PathIsRelative(const char *)
Check if a path is relative.
int SCDefaultMkDir(const char *path)
Wrapper around SCMkDir with default mode arguments.
const char * SCBasename(const char *path)
int PathIsAbsolute(const char *)
Check if a path is absolute.