Skip to content

Commit

Permalink
spawn/ResourceLimits: use static_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Dec 11, 2023
1 parent b5480a1 commit e4f6424
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/spawn/ResourceLimits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ using my_rlimit_resource_t = decltype(RLIMIT_NLIMITS);
inline void
ResourceLimit::Get(int pid, int resource)
{
if (prlimit(pid, my_rlimit_resource_t(resource), nullptr, this) < 0)
if (prlimit(pid, static_cast<my_rlimit_resource_t>(resource),
nullptr, this) < 0)
throw FmtErrno("getrlimit({}) failed", resource);
}

inline void
ResourceLimit::Set(int pid, int resource) const
{
if (prlimit(pid, my_rlimit_resource_t(resource), this, nullptr) < 0)
if (prlimit(pid, static_cast<my_rlimit_resource_t>(resource),
this, nullptr) < 0)
throw FmtErrno("setrlimit({}, {}, {}) failed",
resource, rlim_cur, rlim_max);
}
Expand Down

0 comments on commit e4f6424

Please sign in to comment.