#! /bin/sh
+# This file is part of GNU tar testsuite.
+# Copyright (C) 2004 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
# Unreadable directories yielded error despite --ignore-failed-read.
. ./preset
> check-uid
set - x`ls -l check-uid`
-if test $3 = root; then
+uid_name="$3"
+set - x`ls -ln check-uid`
+uid_number="$3"
+if test "$uid_name" = root || test "$uid_number" = 0; then
# The test is meaningless for super-user.
rm check-uid
err="\
-----
-tar: Cannot add file file: Permission denied
+tar: file: Cannot open: Permission denied
tar: Error exit delayed from previous errors
-----
-tar: Cannot add file file: Permission denied
+tar: file: Warning: Cannot open: Permission denied
-----
-tar: Cannot add directory directory: Permission denied
+tar: directory: Cannot savedir: Permission denied
tar: Error exit delayed from previous errors
-----
-tar: Cannot add directory directory: Permission denied
+tar: directory: Warning: Cannot savedir: Permission denied
"
fi