[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#233798: Patch to check for mount options



Colin Watson <cjwatson@debian.org> writes:

> +# Return zero if it is possible to create devices and execute programs in
> +# this directory. (Both may be forbidden by mount options, e.g. nodev and
> +# noexec respectively.)
> +check_sane_mount () {
> +  case "$ARCH" in
> +    kfreebsd-*|hurd-*)
> +    ;;
> +    *)
> +      mknod "$1/test-dev-null" c 1 3 || return 1
> +      if ! echo test > "$1/test-dev-null"; then
> +        rm -f "$1/test-dev-null"
> +        return 1
> +      fi
> +      rm -f "$1/test-dev-null"
> +      ;;
> +  esac
> +
> +  cat > "$1/test-exec" <<EOF
> +#! /bin/sh
> +:
> +EOF
> +  chmod +x "$1/test-exec"
> +  if ! "$1/test-exec"; then
> +    rm -f "$1/test-exec"
> +    return 1
> +  fi
> +  rm -f "$1/test-exec"
> +
> +  return 0
> +}
> +

Cool :-)

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."




Reply to: