From: Lukas Sismis Date: Wed, 24 Jul 2024 20:45:20 +0000 (+0200) Subject: util-path: remove dead code X-Git-Tag: suricata-8.0.0-beta1~194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5027e41e988520eb50a907005733ba0f37ada3c;p=thirdparty%2Fsuricata.git util-path: remove dead code --- diff --git a/src/util-path.c b/src/util-path.c index 34c4cc75ca..356c4a7727 100644 --- a/src/util-path.c +++ b/src/util-path.c @@ -117,42 +117,6 @@ char *PathMergeAlloc(const char *const dir, const char *const fname) return ret; } -/** - * \brief Wrapper to join a directory and filename and resolve using realpath - * _fullpath is used for WIN32 - * - * \param out_buf output buffer. Up to PATH_MAX will be written. Unchanged on exit failure. - * \param buf_size length of output buffer, must be PATH_MAX - * \param dir the directory - * \param fname the filename - * - * \retval 0 on success - * \retval -1 on failure - */ -int PathJoin(char *out_buf, size_t buf_size, const char *const dir, const char *const fname) -{ - SCEnter(); - if (buf_size != PATH_MAX) { - return -1; - } - if (PathMerge(out_buf, buf_size, dir, fname) != 0) { - SCLogError("Could not join filename to path"); - return -1; - } - char *tmp_buf = SCRealPath(out_buf, NULL); - if (tmp_buf == NULL) { - SCLogError("Error resolving path: %s", strerror(errno)); - return -1; - } - memset(out_buf, 0, buf_size); - size_t ret = strlcpy(out_buf, tmp_buf, buf_size); - free(tmp_buf); - if (ret >= buf_size) { - return -1; - } - return 0; -} - /** * \brief Wrapper around SCMkDir with default mode arguments. */ diff --git a/src/util-path.h b/src/util-path.h index fee58eabd3..b2b2624908 100644 --- a/src/util-path.h +++ b/src/util-path.h @@ -51,7 +51,6 @@ int PathIsAbsolute(const char *); int PathIsRelative(const char *); 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 PathJoin(char *out_buf, size_t buf_len, const char *const dir, const char *const fname); int SCDefaultMkDir(const char *path); int SCCreateDirectoryTree(const char *path, const bool final); bool SCPathExists(const char *path);