[Pdbg] [PATCH] main: Run as root

Michael Neuling mikey at neuling.org
Wed Mar 28 15:19:17 AEDT 2018


Thanks Amitay,

There are some parts of pgdb that won't need root. Seems like we should add
something like this when we actually try to open a device and get an EPERM.  

Also a commit message as to why we need this would be nice here.

Mikey


> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  src/main.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/main.c b/src/main.c
> index 121e4ad..878761c 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -493,6 +493,11 @@ int main(int argc, char *argv[])
>  	if (target_select())
>  		return 1;
>  
> +	if (geteuid() != 0) {
> +		fprintf(stderr, "Run as root\n");
> +		return 1;
> +	}


More information about the Pdbg mailing list