|
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... | |
| int | PathMerge (char *out_buf, size_t buf_size, const char *const dir, const char *const fname) |
| char * | PathMergeAlloc (const char *const dir, const char *const fname) |
| 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) |
| bool | SCPathContainsTraversal (const char *path) |
| Check for directory traversal. More... | |
| FILE * | SCFopenLogFile (const char *path, const char *mode) |
| Open a text log file for append or truncate. More... | |
| int | SCTouchFile (const char *path) |
| Update access and modification time of an existing file to 'now'. More... | |
Definition in file util-path.c.
| #define DIRECTORY_SEPARATOR '/' |
Definition at line 35 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 45 of file util-path.c.
Referenced by PathIsRelative(), SCConfLogOpenGeneric(), SCConfYamlHandleInclude(), SCProfilingKeywordsGlobalInit(), SCProfilingPrefilterGlobalInit(), and SCProfilingSghsGlobalInit().

| int PathIsRelative | ( | const char * | path | ) |
Check if a path is relative.
| path | string with the path |
| 1 | relative |
| 0 | not relative |
Definition at line 70 of file util-path.c.
References PathIsAbsolute().

| int PathMerge | ( | char * | out_buf, |
| size_t | buf_size, | ||
| const char *const | dir, | ||
| const char *const | fname | ||
| ) |
Definition at line 75 of file util-path.c.
References strlcat(), and strlcpy().
Referenced by PathMergeAlloc().


| char* PathMergeAlloc | ( | const char *const | dir, |
| const char *const | fname | ||
| ) |
Definition at line 108 of file util-path.c.
References PathMerge(), and SCStrdup.

| const char* SCBasename | ( | const char * | path | ) |
Definition at line 247 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 138 of file util-path.c.
References len, p, SCDefaultMkDir(), and strlcpy().

| int SCDefaultMkDir | ( | const char * | path | ) |
Wrapper around SCMkDir with default mode arguments.
Definition at line 124 of file util-path.c.
References SCMkDir.
Referenced by SCCreateDirectoryTree().

| FILE* SCFopenLogFile | ( | const char * | path, |
| const char * | mode | ||
| ) |
Open a text log file for append or truncate.
On Windows, allows the file to be renamed or deleted while open so that external tools can rotate it. Only modes "a" and "w" are supported on all platforms; other modes fail with errno set to EINVAL.
| path | The file path to open |
| mode | "a" to append or "w" to truncate |
| FILE* | on success |
| NULL | on error with errno set |
Definition at line 291 of file util-path.c.
References SCWin32Fopen().

| 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 198 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 216 of file util-path.c.
| bool SCPathContainsTraversal | ( | const char * | path | ) |
Check for directory traversal.
| path | The path string to check for traversal |
| true | if directory traversal is found, otherwise false |
Definition at line 269 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 184 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 232 of file util-path.c.
| int SCTouchFile | ( | const char * | path | ) |
Update access and modification time of an existing file to 'now'.
| path | The file path to touch |
| 0 | on success, -1 on failure |
Definition at line 310 of file util-path.c.