[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: PATCH: pyblock: return empty list instead of error when run as non-root
- From: Joel Granados <jgranado redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: Re: PATCH: pyblock: return empty list instead of error when run as non-root
- Date: Thu, 30 Oct 2008 06:46:59 -0400 (EDT)
Don't see anything obviously wrong here. I would go ahead and commit.
----- "Hans de Goede" <hdegoede redhat com> 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 redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
--
Joel Andres Granados
Red Hat / Brno Czech Republic
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]