Skip to content

Commit

Permalink
Remove wordexp
Browse files Browse the repository at this point in the history
  • Loading branch information
wwbmmm authored and XiguoHu committed Apr 23, 2023
1 parent d91768b commit 8cc57b0
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/brpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// under the License.


#include <wordexp.h> // wordexp
#include <iomanip>
#include <arpa/inet.h> // inet_aton
#include <fcntl.h> // O_CREAT
Expand Down Expand Up @@ -1716,23 +1715,7 @@ void Server::GenerateVersionIfNeeded() {
}
}

static std::string ExpandPath(const std::string &path) {
if (path.empty()) {
return std::string();
}
std::string ret;
wordexp_t p;
wordexp(path.c_str(), &p, 0);
CHECK_EQ(p.we_wordc, 1u);
if (p.we_wordc == 1) {
ret = p.we_wordv[0];
}
wordfree(&p);
return ret;
}

void Server::PutPidFileIfNeeded() {
_options.pid_file = ExpandPath(_options.pid_file);
if (_options.pid_file.empty()) {
return;
}
Expand Down

0 comments on commit 8cc57b0

Please sign in to comment.