Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
diff sbin/ftjail @ 644:0c7917469e04
Put the check for opened files with "procstat" into a subroutine and use it
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 27 Sep 2024 17:23:01 +0200 |
| parents | 4f2257ea7d0a |
| children | b0e8b5cf5d33 |
line wrap: on
line diff
--- a/sbin/ftjail Fri Sep 27 17:07:57 2024 +0200 +++ b/sbin/ftjail Fri Sep 27 17:23:01 2024 +0200 @@ -931,22 +931,9 @@ return 1 fi done - # - # Check whether there are any open files within the jail. - # - # "procstat file" also lists fifo, socket, message queue, kgueue et al. - # file types. - # - # Note that procstat places extra whitespace at the end of lines sometimes. - # - # - if procstat -a file | /usr/bin/grep -E '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then - echo "ERROR: There are open files within the jail" >&2 - return 1 - fi - # The same for memory mappings - if procstat -a vm | /usr/bin/grep -E '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then - echo "ERROR: There are open memory mappings within the jail" >&2 + # Check whether there are any open files or VM mappings within the jail. + if ! _check_no_open_files_from_all_proc "${_directory}" ; then + err "There are open files or memory mappings within the jail" return 1 fi
