Merge branch 'slab/for-6.2/tools' into slab/for-next

A patch for tools/vm/slabinfo to give more useful feedback when not run
as a root, by Rong Tao.
This commit is contained in:
Vlastimil Babka 2022-11-10 10:41:06 +01:00
commit 1c1aaa3319

View File

@ -157,9 +157,11 @@ static unsigned long read_obj(const char *name)
{
FILE *f = fopen(name, "r");
if (!f)
if (!f) {
buffer[0] = 0;
else {
if (errno == EACCES)
fatal("%s, Try using superuser\n", strerror(errno));
} else {
if (!fgets(buffer, sizeof(buffer), f))
buffer[0] = 0;
fclose(f);