From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Unhelpful permissions in some /proc files Date: Mon, 04 Apr 2005 12:32:00 +0200 Message-ID: References: <424DBAE9.7060208@yahoo.fr> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Mon_Apr__4_12:32:00_2005-1" Return-path: In-Reply-To: <424DBAE9.7060208@yahoo.fr> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Guillaume Chazarain Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Mon_Apr__4_12:32:00_2005-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Mon_Apr__4_12:32:00_2005-1 Content-Type: text/plain; charset=US-ASCII 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) { --Multipart_Mon_Apr__4_12:32:00_2005-1-- ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click