>From 23ebbd7984492f740eda2ccd665a6745fd47d2d8 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Tue, 10 Sep 2013 16:34:35 +0400 Subject: [PATCH 4/4] TMP: mki-sh-functions: get_copy_args() += warning --- tools/mki-sh-functions | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/mki-sh-functions b/tools/mki-sh-functions index 0fb9625..99b126a 100755 --- a/tools/mki-sh-functions +++ b/tools/mki-sh-functions @@ -55,8 +55,9 @@ check_protected_hardlinks() { [ -f /proc/sys/fs/protected_hardlinks ] || return 0 - ln "$chroot/bin/true" "$chroot/var/tmp" 2>/dev/null && - rm -f "$chroot/var/tmp" + # /proc file unreadable, do a functional test + ln "$chroot/bin/true" "$chroot/var/tmp/" 2>/dev/null && + rm -f "$chroot/var/tmp/true" } cp_args= @@ -69,8 +70,11 @@ get_copy_args() { [ $(find "$@" -printf '%D\n' 2>/dev/null |sort -u |wc -l) -eq 1 ] || return 0 - check_protected_hardlinks || + # can do with data copies but it's very expensive resource-wise + if ! check_protected_hardlinks; then + message "Warning: echo 0 > /proc/sys/fs/protected_hardlinks" return 0 + fi cp_args='-l' } -- 1.8.3.4