stat: determine whether it is BSD or GNU flavor

Seems like MacOS may have either in the path.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman
2017-02-12 14:23:16 -08:00
parent 41ba1d99c8
commit f9bec4ed7c
3 changed files with 88 additions and 5 deletions

View File

@ -567,15 +567,15 @@ CT_DoForceRmdir() {
local mode
for dir in "${@}"; do
[ -d "${dir}" ] || continue
case "$CT_SYS_OS" in
Linux|CYGWIN*)
case "${CT_CONFIGURE_has_stat_flavor_GNU},${CT_CONFIGURE_has_stat_flavor_BSD}" in
y,*)
mode="$(stat -c '%a' "$(dirname "${dir}")")"
;;
Darwin|*BSD)
*,y)
mode="$(stat -f '%Lp' "$(dirname "${dir}")")"
;;
*)
CT_Abort "Unhandled host OS $CT_SYS_OS"
CT_Abort "Unknown stat format options"
;;
esac
CT_DoExecLog ALL chmod u+w "$(dirname "${dir}")"