Skip to content

Commit

Permalink
kyua: use POSIX PATH_MAX constant instead of a magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
ihoro committed Feb 1, 2024
1 parent e036807 commit 4312026
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contrib/kyua/utils/process/jail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "utils/process/jail.hpp"

extern "C" {
#include <limits.h>
#include <unistd.h>
#include <sys/stat.h>

Expand Down Expand Up @@ -218,8 +219,8 @@ process::jail::exec(const std::string& jail_name,
const args_vector& args) throw()
{
// get work dir prepared by kyua
char cwd[256];
if (getcwd(cwd, 256) == NULL) {
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd)) == NULL) {
std::cerr << "process::jail::exec: getcwd() errors: "
<< strerror(errno) << ".\n";
std::exit(EXIT_FAILURE);
Expand Down

0 comments on commit 4312026

Please sign in to comment.