Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Guillaume Chazarain <guichaz@yahoo.fr>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Unhelpful permissions in some /proc files
Date: Mon, 04 Apr 2005 12:32:00 +0200	[thread overview]
Message-ID: <s5h8y3yde8v.wl@alsa2.suse.de> (raw)
In-Reply-To: <424DBAE9.7060208@yahoo.fr>

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

At Fri, 01 Apr 2005 23:19:37 +0200,
Guillaume Chazarain wrote:
> 
> Hello,
> 
> Some tunables in /proc have a write() function, but as their
> permission does not reflect it, it can be confusing to the user.
> 
> So here is a patch that corrects the mode of those files. Note that I
> have only tested the "xrun_debug" entry.

Thanks for the patch.

> Also, there is a little inconsistency in that some code does
> 'entry->mode = S_IFREG | S_IRUGO | S_IWUSR;' whereas some other does
> 'entry->mode |= S_IWUSR;'.

I think the latter form is enough.

BTW, instead of patching each part, checking S_IWUSR in
snd_info_register() may an easier solution.  The patch is below.


Takashi

[-- Attachment #2: Type: text/plain, Size: 800 bytes --]

Index: alsa-kernel/core/info.c
===================================================================
RCS file: /home/iwai/cvs/alsa/alsa-kernel/core/info.c,v
retrieving revision 1.48
diff -u -r1.48 info.c
--- alsa-kernel/core/info.c	22 Mar 2005 15:18:27 -0000	1.48
+++ alsa-kernel/core/info.c	4 Apr 2005 10:31:14 -0000
@@ -910,6 +910,12 @@
 
 	snd_assert(entry != NULL, return -ENXIO);
 	root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
+	if ((entry->content == SNDRV_INFO_CONTENT_TEXT && entry->c.text.write_size) ||
+	    (entry->content == SNDRV_INFO_CONTENT_DATA && entry->c.ops->write)) {
+		/* fix up write permission */
+		if (! (entry->mode & S_IWUGO))
+			entry->mode |= S_IWUSR;
+	}
 	down(&info_mutex);
 	p = snd_create_proc_entry(entry->name, entry->mode, root);
 	if (!p) {

  reply	other threads:[~2005-04-04 10:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01 21:19 Unhelpful permissions in some /proc files Guillaume Chazarain
2005-04-04 10:32 ` Takashi Iwai [this message]
2005-04-04 12:24   ` Guillaume Chazarain
2005-04-12 15:34     ` Takashi Iwai

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=s5h8y3yde8v.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=guichaz@yahoo.fr \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox