[PATCH radeontool 2/5] Warn if run without superuser rights

Jonathan Nieder jrnieder at gmail.com
Fri Dec 2 14:45:41 PST 2011


Hi,

Tormod Volden wrote:

> From: Tormod Volden <debian.tormod at gmail.com>
>
> Signed-off-by: Tormod Volden <debian.tormod at gmail.com>

I think there's a line or so of room here to explain the purpose of
this patch. :)

[...]
> --- a/radeontool.c
> +++ b/radeontool.c
> @@ -2951,6 +2951,8 @@ void radeon_rom_tables(const char * file)
>  
>  int main(int argc,char *argv[]) 
>  {
> +    if (geteuid() != 0)
> +	fprintf(stderr, "Warning: Need root privileges to access hardware\n");

Whitespace damage.

The functional change should be harmless: it's possible the non-root
caller was given access to the relevant part of /sys/bus/pci, but it's
unlikely, and when that happens the program is just usable --- there's
just a warning.

But what is the motivation?  Does avivotool need something like this,
too?  Perhaps the message

	fatal error: mapping ctrl region

is not clear enough, and it would be better to tweak it to say
something like

	fatal error: cnanot map ctrl region: Permission denied

Thanks.

Jonathan


More information about the xorg-driver-ati mailing list