ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Konstantin A. Lepikhov" <lakostis@altlinux.org>
To: ALT Devel discussion list <devel@altlinux.ru>
Subject: [devel] Re: NMU: cdrecord
Date: Mon, 13 Dec 2004 17:37:04 +0300
Message-ID: <20041213143704.GB7433@lks.home> (raw)
In-Reply-To: <20041213110217.GJ6127@basalt.office.altlinux.org>


[-- Attachment #1.1: Type: text/plain, Size: 671 bytes --]

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

[-- Attachment #1.2: cdrtools-2.01a37-skipcheck_priv.patch --]
[-- Type: text/plain, Size: 2689 bytes --]

--- 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
+}

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 2212 bytes --]

  reply	other threads:[~2004-12-13 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-12 21:56 [devel] " Konstantin A. Lepikhov
2004-12-12 22:18 ` [devel] " Konstantin A. Lepikhov
2004-12-12 23:05   ` Konstantin A. Lepikhov
2004-12-13 10:49 ` [devel] " Dmitry V. Levin
2004-12-13 10:57   ` [devel] " Konstantin A. Lepikhov
2004-12-13 11:02     ` Dmitry V. Levin
2004-12-13 14:37       ` Konstantin A. Lepikhov [this message]
2004-12-13 15:36         ` Sergey Vlasov
2004-12-13 16:48           ` Konstantin A. Lepikhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041213143704.GB7433@lks.home \
    --to=lakostis@altlinux.org \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git