File access permissions allow users and root to read PCI config spaces
of devices via sysfs. But depending on your uid you will read different
content.
That is why we have to make sure we open those files as root and can not
just rely on getting an EPERM.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
[Jan: removed extra blank line]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
set -e
+if test $UID -ne 0; then
+ echo "Please run as root" 1>&2
+ exit 1
+fi
+
if test -z "$1"; then
echo "Usage: $0 mytarget.tar" 1>&2
exit 1
return MMConfig(base, end_bus)
+if (
+ (options.generate_collector is False) and (options.root is '/')
+ and (os.geteuid() is not 0)
+):
+ print('ERROR: You have to be root to work on "/"!', file=sys.stderr)
+ sys.exit(1)
+
(pcidevices, pcicaps) = parse_pcidevices()
product = [input_readline('/sys/class/dmi/id/sys_vendor',