1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

o fix get_word

o capy name in when registering targets

o change _line_splitter so it expects the process functions to return zero
  on success
This commit is contained in:
Joe Thornber 2001-08-22 14:13:26 +00:00
parent 9d4aaf49c1
commit a548e9cc40
2 changed files with 7 additions and 4 deletions

View File

@ -258,7 +258,7 @@ static int _get_word(const char *b, const char *e,
return 0;
*wb = b;
while(b != e && !isspace((int) b))
while(b != e && !isspace((int) *b))
b++;
*we = b;
return 1;
@ -267,6 +267,7 @@ static int _get_word(const char *b, const char *e,
static int _line_splitter(struct file *file, const char *buffer,
unsigned long count, void *data)
{
int r;
const char *b = buffer, *e = buffer + count, *lb;
struct pf_data *pfd = (struct pf_data *) data;
@ -279,8 +280,8 @@ static int _line_splitter(struct file *file, const char *buffer,
while((b != e) && *b != '\n')
b++;
if (!pfd->fn(lb, b, pfd->minor))
return lb - buffer;
if ((r = pfd->fn(lb, b, pfd->minor)))
return r;
}
return count;

View File

@ -61,7 +61,9 @@ int register_map_target(const char *name, dm_ctr_fn ctr,
return -1; /* FIXME: what's a good return value ? */
}
t->name = name;
t->name = (char *) t + 1;
strcpy(t->name, name);
t->ctr = ctr;
t->dtr = dtr;
t->map = map;