Skip to content

Commit

Permalink
Add more error handling to bp2::ext cwd.ipp. (#354)
Browse files Browse the repository at this point in the history
* Add more error handling to bp2::ext cwd.ipp.

* Remove redundant errno checks

these functions don't fail...
  • Loading branch information
time-killer-games authored Mar 31, 2024
1 parent 7a17af0 commit 2ae279b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions include/boost/process/v2/ext/impl/cwd.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code

#elif defined(__FreeBSD__)

// FIXME: Add error handling.
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
{
filesystem::path path;
Expand All @@ -139,9 +138,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
filestat *fst = nullptr;
STAILQ_FOREACH(fst, head, next) {
if (fst->fs_uflags & PS_FST_UFLAG_CDIR)
{
path = filesystem::canonical(fst->fs_path, ec);
}
}
procstat_freefiles(proc_stat, head);
}
Expand All @@ -160,7 +157,6 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code

#elif defined(__DragonFly__)

// FIXME: Add error handling.
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
{
filesystem::path path;
Expand All @@ -185,7 +181,8 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
}
else
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
pclose(fp);
if (pclose(fp) == -1)
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
}
else
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
Expand Down

0 comments on commit 2ae279b

Please sign in to comment.