suricata
|
Go to the source code of this file.
Macros | |
#define | DIRECTORY_SEPARATOR '/' |
Functions | |
int | PathIsAbsolute (const char *path) |
Check if a path is absolute. More... | |
int | PathIsRelative (const char *path) |
Check if a path is relative. More... | |
TmEcode | PathJoin (char *out_buf, uint16_t buf_len, const char *const dir, const char *const fname) |
Wrapper to join a directory and filename and resolve using realpath _fullpath is used for WIN32. More... | |
int | SCDefaultMkDir (const char *path) |
Wrapper around SCMkDir with default mode arguments. More... | |
int | SCCreateDirectoryTree (const char *path, const bool final) |
Recursively create a directory. More... | |
bool | SCPathExists (const char *path) |
Check if a path exists. More... | |
bool | SCIsRegularDirectory (const struct dirent *const dir_entry) |
OS independent wrapper for directory check. More... | |
bool | SCIsRegularFile (const struct dirent *const dir_entry) |
OS independent to check for regular file. More... | |
char * | SCRealPath (const char *path, char *resolved_path) |
OS independent wrapper for realpath. More... | |
const char * | SCBasename (const char *path) |
Definition in file util-path.c.
#define DIRECTORY_SEPARATOR '/' |
Definition at line 34 of file util-path.c.
int PathIsAbsolute | ( | const char * | path | ) |
Check if a path is absolute.
path | string with the path |
1 | absolute |
0 | not absolute |
Definition at line 44 of file util-path.c.
Referenced by ConfYamlHandleInclude(), and PathIsRelative().
int PathIsRelative | ( | const char * | path | ) |
Check if a path is relative.
path | string with the path |
1 | relative |
0 | not relative |
Definition at line 69 of file util-path.c.
References PathIsAbsolute().
Referenced by ConfLoadCompleteIncludePath(), and DetectLoadCompleteSigPath().
TmEcode PathJoin | ( | char * | out_buf, |
uint16_t | buf_len, | ||
const char *const | dir, | ||
const char *const | fname | ||
) |
Wrapper to join a directory and filename and resolve using realpath _fullpath is used for WIN32.
out_buf | output buffer. Up to PATH_MAX will be written. Unchanged on exit failure. |
buf_len | length of output buffer |
dir | the directory |
fname | the filename |
TM_ECODE_OK | on success |
TM_ECODE_FAILED | on failure |
Definition at line 86 of file util-path.c.
References DIRECTORY_SEPARATOR, MAX, SCEnter, SCLogError, SCRealPath(), SCReturnInt, strlcpy(), TM_ECODE_FAILED, and TM_ECODE_OK.
const char* SCBasename | ( | const char * | path | ) |
Definition at line 235 of file util-path.c.
References DIRECTORY_SEPARATOR.
int SCCreateDirectoryTree | ( | const char * | path, |
const bool | final | ||
) |
Recursively create a directory.
path | Path to create |
final | true will create the final path component, false will not |
0 | on success |
-1 | on error |
Definition at line 123 of file util-path.c.
References len, SCDefaultMkDir(), and strlcpy().
int SCDefaultMkDir | ( | const char * | path | ) |
Wrapper around SCMkDir with default mode arguments.
Definition at line 109 of file util-path.c.
References SCMkDir.
Referenced by SCCreateDirectoryTree().
bool SCIsRegularDirectory | ( | const struct dirent *const | dir_entry | ) |
OS independent wrapper for directory check.
dir_entry | object to check |
True | if the object is a regular directory, otherwise false. This directory and parent directory will return false. |
Definition at line 186 of file util-path.c.
bool SCIsRegularFile | ( | const struct dirent *const | dir_entry | ) |
OS independent to check for regular file.
dir_entry | object to check |
True | if the object is a regular file. Otherwise false. |
Definition at line 204 of file util-path.c.
bool SCPathExists | ( | const char * | path | ) |
Check if a path exists.
Path | to check for existence |
true | if path exists |
false | if path does not exist |
Definition at line 169 of file util-path.c.
char* SCRealPath | ( | const char * | path, |
char * | resolved_path | ||
) |
OS independent wrapper for realpath.
path | the path to resolve |
resolved_path | the resolved path; if null, a buffer will be allocated |
the | resolved_path; or a pointer to a new resolved_path buffer |
Definition at line 220 of file util-path.c.
Referenced by PathJoin().