Re: PATCH: pyblock: return empty list instead of error when run as non-root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't see anything obviously wrong here.  I would go ahead and commit.
----- "Hans de Goede" <hdegoede@xxxxxxxxxx> wrote:

> Hi All,
> 
> This patch is necessary to run pychecker as non root,
> 
> Regards,
> 
> Hans
> 
> diff -up pyblock-0.32/dm.c~ pyblock-0.32/dm.c
> --- pyblock-0.32/dm.c~	2008-10-24 15:31:33.000000000 +0200
> +++ pyblock-0.32/dm.c	2008-10-24 15:31:33.000000000 +0200
> @@ -1560,7 +1560,7 @@ pydm_rmpart(PyObject *self, PyObject *ar
>  static PyObject *
>  pydm_maps(PyObject *self)
>  {
> -	struct dm_task *task;
> +	struct dm_task *task = NULL;
>  	struct dm_names *names;
>  	int n;
>  	unsigned int next = 0;
> @@ -1571,6 +1571,14 @@ pydm_maps(PyObject *self)
>  	if (!list)
>  		goto out;
>  
> +        /* dm_task_create() only works as root for non root use just
> return an
> +           empty list */
> +        if (geteuid()) {
> +		printf("%s: %d: not running as root returning empty list\n",
> +			__FILE__, __LINE__);
> +		goto save_list;
> +        }
> +
>  	task = dm_task_create(DM_DEVICE_LIST);
>  	if (!task) {
>  		if (!PyErr_Occurred()) {
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
Joel Andres Granados
Red Hat / Brno Czech Republic

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux