From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Fri, 07 May 2004 21:52:56 +0000 Subject: Re: [PATCH] udev callout for reading filesystem labels Message-Id: <20040507215256.GA3906@vrfy.org> List-Id: References: <20040429210446.GA9836@vrfy.org> In-Reply-To: <20040429210446.GA9836@vrfy.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Fri, May 07, 2004 at 08:25:34PM +0200, Arnd Bergmann wrote: > - Call set_label_string() to normalize the dasd label like fs labels. > - Improve set_label_string() to fix up other problems with the label > beside just trailing blanks. > -static void set_label_string(struct volume_id *id, char *buf, int count) > +void set_label_string(struct volume_id *id, char *buf, int count) > { > int i; > > memcpy(id->label_string, buf, count); > > - /* remove trailing whitespace */ > - i = strlen(id->label_string); > + /* remove trailing whitespace and garbage */ > + i = strnlen(id->label_string, VOLUME_ID_LABEL_SIZE); > while (i--) { > - if (! isspace(id->label_string[i])) > + id->label_string[i+1] = '\0'; > + if (isalnum(id->label_string[i])) > break; > } > - id->label_string[i+1] = '\0'; > + /* replace remaining garbage with '_' */ > + while (i--) { > + if (!isalnum(id->label_string[i])) > + id->label_string[i] = '_'; Hmm, doesn't it break UTF-8 characters, which are common in udf labels? Should we better do it only for dasd and keep the set_label_string() private? Kay ------------------------------------------------------- This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO. http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel