FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Red Hat Linux

 
 
LinkBack Thread Tools
 
Old 10-29-2008, 03:03 PM
Hans de Goede
 
Default PATCH: pyblock: return empty list instead of error when run as non-root

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
",
+ __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
 

Thread Tools




All times are GMT. The time now is 12:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org