summaryrefslogtreecommitdiff
path: root/namedev.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-04-21 17:49:44 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:16 -0700
commita36a3c3a44286e77d6ec05c7579f61b4eb0ee344 (patch)
treecd6295f0a398fa34f4b7e9eb2daa0e1e6a2aba4d /namedev.c
parent3a0b657b76ea3844e8bc7f742adba1d7f16f7d2c (diff)
[PATCH] fix test regressions
On Sat, Apr 17, 2004 at 03:30:29AM +0200, Kay Sievers wrote: > On Sat, Apr 17, 2004 at 02:04:55AM +0200, Kay Sievers wrote: > > On Fri, Apr 16, 2004 at 04:04:42PM -0700, Greg KH wrote: > > > Oh, and if you run the latest udev_test.pl, we have a bunch more tests, > > > including a few that fail, if you were looking for something to do :) > > > > Will do it. We need to change apply_format(). I tries to expand the '%%' > > with the next iteration over the string and removes the '%'. The tests are all successful now. If this patch breaks something else, we simply have too few tests :)
Diffstat (limited to 'namedev.c')
-rw-r--r--namedev.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/namedev.c b/namedev.c
index 51a4639abe..b3a2a8ae4b 100644
--- a/namedev.c
+++ b/namedev.c
@@ -199,23 +199,21 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize,
struct sysfs_attribute *tmpattr;
pos = string;
-
while (1) {
- pos = strchr(string, '%');
- if (pos != NULL) {
- pos[0] = '\0';
- tail = pos+1;
- len = get_format_len(&tail);
- c = tail[0];
- strfieldcpy(temp, tail+1);
- tail = temp;
- } else {
+ pos = strchr(pos, '%');
+ if (pos == NULL)
break;
- }
- dbg("format=%c, string='%s', tail='%s'",c , string, tail);
+ pos[0] = '\0';
+ tail = pos+1;
+ len = get_format_len(&tail);
+ c = tail[0];
+ strfieldcpy(temp, tail+1);
+ tail = temp;
+ dbg("format=%c, string='%s', tail='%s'",c , string, tail);
attr = get_format_attribute(&tail);
+
switch (c) {
case 'b':
if (strlen(udev->bus_id) == 0)
@@ -286,6 +284,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize,
break;
case '%':
strfieldcatmax(string, "%", maxsize);
+ pos++;
break;
default:
dbg("unknown substitution type '%%%c'", c);