[devel] Re: NMU: cdrecord

Konstantin A. Lepikhov =?iso-8859-1?q?lakostis_=CE=C1_altlinux=2Eorg?=
Пн Дек 13 17:37:04 MSK 2004


Hi Dmitry!

Monday 13, at 02:02:17 PM you wrote:

> On Mon, Dec 13, 2004 at 01:57:39PM +0300, Konstantin A. Lepikhov wrote:
> > > > у ldv@ есть желание сделать это в Сизиф/updates?
> > > 
> > > Нет, это же 2.6-only change:
> > > 
> > OK а если я сделаю обвязку на kernel_version?
> 
> Тогда можете взять переходящий флаг мантейнера пакета.
Никто не против такого патча? Если нет, я выкладываю в Сизиф и
backports

-- 
WBR, Konstantin	      chat with ==>ICQ: 109916175
     Lepikhov,	      speak  to ==>JID: lakostis на jabber.org
aka L.A. Kostis       write  to ==>mailto:lakostis на pisem.net.nospam

...The information is like the bank... 			  (c) EC8OR
----------- следующая часть -----------
--- cdrtools-2.01a37/cdrecord/cdrecord.c.skipcheck_priv	2004-12-13 14:45:02 +0300
+++ cdrtools-2.01a37/cdrecord/cdrecord.c	2004-12-13 14:52:03 +0300
@@ -242,7 +242,7 @@ LOCAL	void	print_drflags	__PR((cdr_t *dp
 LOCAL	void	print_wrmodes	__PR((cdr_t *dp));
 LOCAL	BOOL	check_wrmode	__PR((cdr_t *dp, int wmode, int tflags));
 LOCAL	void	set_wrmode	__PR((cdr_t *dp, int wmode, int tflags));
-LOCAL	void	linuxcheck	__PR((void));
+LOCAL	BOOL	linuxcheck	__PR((void));
 
 struct exargs {
 	SCSI	*scgp;
@@ -465,8 +465,10 @@ main(ac, av)
 	}
 	/*
 	 * XXX Below this point we do not need root privilleges anymore.
+	 *
+	 * XXX Skip this on Linux kernel >= 2.6.9
 	 */
-	if (geteuid() != getuid()) {	/* AIX does not like to do this */
+	if (geteuid() != getuid() && !linuxcheck()) {	/* AIX does not like to do this */
 					/* If we are not root		*/
 #ifdef	HAVE_SETREUID
 		if (setreuid(-1, getuid()) < 0)
@@ -982,8 +984,10 @@ if (lverbose > 2)
 		 * Note that we need to find a more general way that works
 		 * even on OS that do not support getreuid() which is *BSD
 		 * and SUSv3 only.
+		 *
+		 * XXX Skip this on Linux kernel >= 2.6.9
 		 */
-		if (oeuid != getuid()) {
+		if (oeuid != getuid() && !linuxcheck()) {
 			if (setreuid(-1, oeuid) < 0)
 				errmsg("Could set back effective uid.\n");
 		}
@@ -1000,8 +1004,10 @@ if (lverbose > 2)
 #if defined(USE_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SETREUID)
 		/*
 		 * XXX Below this point we never need root privilleges anymore.
+		 *
+		 * XXX Skip this on Linux kernel >= 2.6.9
 		 */
-		if (geteuid() != getuid()) {	/* AIX does not like to do this */
+		if (geteuid() != getuid() && !linuxcheck()) {	/* AIX does not like to do this */
 						/* If we are not root		*/
 			if (setreuid(-1, getuid()) < 0)
 				comerr("Panic cannot set back effective uid.\n");
@@ -4619,3 +4625,34 @@ set_wrmode(dp, wmode, tflags)
 	}
 	dsp->ds_wrmode = WM_NONE;
 }
+/*
+ * Kludge for checking linux kernel version
+ * enabling this hack only for >= 2.6.9 kernel
+ *
+ */
+#if    defined(linux) || defined(__linux) || defined(__linux__)
+#ifdef HAVE_UNAME
+#include <sys/utsname.h>
+#endif
+#endif
+
+LOCAL BOOL
+linuxcheck()
+{
+#if    defined(linux) || defined(__linux) || defined(__linux__)
+#ifdef HAVE_UNAME
+	struct  utsname un;
+	if (uname(&un) >= 0) {
+		if ((un.release[0] == '2' && un.release[1] == '.') &&
+		    (un.release[2] == '6' && un.release[3] >= 9)) {
+			errmsgno(EX_BAD,
+			"Warning: Running on Linux-%s\n", un.release);
+			errmsgno(EX_BAD,
+			"Enabling compatability hack!\n");
+			return (TRUE);
+		}
+	}
+#endif
+	return (FALSE);
+#endif
+}
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : smime.p7s
Тип     : application/x-pkcs7-signature
Размер  : 2212 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20041213/2338b022/attachment-0001.bin>


Подробная информация о списке рассылки Devel