diff --git a/pgxn/neon/communicator/src/lib.rs b/pgxn/neon/communicator/src/lib.rs index 84e7038842..d0c5b758da 100644 --- a/pgxn/neon/communicator/src/lib.rs +++ b/pgxn/neon/communicator/src/lib.rs @@ -2,7 +2,6 @@ //! - async tokio communicator core, which receives requests and processes them. //! - Main loop and requests queues, which routes requests from backends to the core //! - the per-backend glue code, which submits requests -#![warn(unused)] mod backend_comms; diff --git a/pgxn/neon/communicator_new.c b/pgxn/neon/communicator_new.c index 9cceafba2f..8b2fc258ee 100644 --- a/pgxn/neon/communicator_new.c +++ b/pgxn/neon/communicator_new.c @@ -178,32 +178,6 @@ assign_request_id(void) return result; } -/* - * Returns the absolute path to the given path. -*/ -static inline char * get_absolute_path(const char *path) -{ - char *abs_path = bounce_buf(); - char cwd[PATH_MAX]; - int size = 0; - - if (path[0] == '/') { - strncpy(abs_path, path, strlen(path)); - return abs_path; - } - - getcwd(cwd, sizeof(cwd)); - - size = snprintf(NULL, 0, "%s/%s", cwd, path); - - if (size < 0 || size >= PATH_MAX) { - return NULL; - } - - snprintf(abs_path, size + 1, "%s/%s", cwd, path); - return abs_path; -} - /**** Initialization functions. These run in postmaster ****/ void @@ -1041,13 +1015,15 @@ communicator_new_read_slru_segment( } }; int nblocks = -1; + char *abs_path = bounce_buf(); if (path == NULL) { elog(ERROR, "read_slru_segment called with NULL path"); return -1; } - request.read_slru_segment.destination_file_path.ptr = (uint8_t *) get_absolute_path(path); + strlcpy(abs_path, path, Min(PATH_MAX, strlen(path) + 1)); + request.read_slru_segment.destination_file_path.ptr = (uint8_t *) abs_path; elog(DEBUG5, "readslrusegment called for kind=%u, segno=%u, file_path=\"%s\"", kind, segno, request.read_slru_segment.destination_file_path.ptr);