On 03/08/10 09:31, Hennerich, Michael wrote: > Skip trailing newline if available. > > From: Michael Hennerich <Michael.Hennerich@xxxxxxxxxx> Dear Michael, Just found this one whilst trying to sort out a clean iio tree. (sorry I completely failed to reply originally) Anyhow, I agree with the principal that we should be ignoring the newline. Actually we should be ignoring whitespace before and after the string we are actually after. Perhaps a cleaner approach is to use sscanf to pull out the string alone? I don't think we need to allow for whitespace in the trigger name (though obviously it should be documented if we do not). Technically I believe (via the convenient lwn article last week on the topic) we should ignore white space but return -EINVAL if there is say one word, some white space and then another word... Not sure if there is a particularly clean way to do that however. What do you think? Jonathan > > Index: drivers/staging/iio/industrialio-trigger.c > =================================================================== > --- drivers/staging/iio/industrialio-trigger.c (revision 8368) > +++ drivers/staging/iio/industrialio-trigger.c (working copy) > @@ -155,6 +155,9 @@ > struct iio_trigger *trig; > bool found = false; > > + if (len && name[len - 1] == '\n') > + len--; > + > mutex_lock(&iio_trigger_list_lock); > list_for_each_entry(trig, &iio_trigger_list, list) { > if (strncmp(trig->name, name, len) == 0) { > > ------------------------------------------------------------------ > ********* Analog Devices GmbH Open Platform Solutions > ** ***** > ** ** Wilhelm-Wagenfeld-Strasse 6 > ** ***** D-80807 Munich > ********* Germany > Registergericht München HRB 40368, Geschäftsführer: Thomas Wessel, William A. Martin, Margaret K. Seif > > > -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html