mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Always truncate error file.
This commit is contained in:
parent
9a193e5eb5
commit
45ee3251a4
@ -40,7 +40,6 @@ struct line_c {
|
|||||||
unsigned int line_num;
|
unsigned int line_num;
|
||||||
loff_t next_read;
|
loff_t next_read;
|
||||||
char data[MAX_TARGET_LINE];
|
char data[MAX_TARGET_LINE];
|
||||||
int error;
|
|
||||||
|
|
||||||
struct file *in;
|
struct file *in;
|
||||||
struct file *out;
|
struct file *out;
|
||||||
@ -119,11 +118,6 @@ static void parse_error(const char *message, void *private)
|
|||||||
char buffer[32];
|
char buffer[32];
|
||||||
struct line_c *lc = (struct line_c *) private;
|
struct line_c *lc = (struct line_c *) private;
|
||||||
|
|
||||||
if (!lc->error) {
|
|
||||||
lc->out = open_error_file(lc->in);
|
|
||||||
lc->error = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define emit(b, l) lc->out->f_op->write(lc->out, (b), (l), &lc->out->f_pos)
|
#define emit(b, l) lc->out->f_op->write(lc->out, (b), (l), &lc->out->f_pos)
|
||||||
|
|
||||||
emit(lc->in->f_dentry->d_name.name, lc->in->f_dentry->d_name.len);
|
emit(lc->in->f_dentry->d_name.name, lc->in->f_dentry->d_name.len);
|
||||||
@ -163,12 +157,12 @@ static int _release_file(struct inode *inode, struct file *f)
|
|||||||
memset(lc, 0, sizeof(*lc));
|
memset(lc, 0, sizeof(*lc));
|
||||||
lc->in = f;
|
lc->in = f;
|
||||||
|
|
||||||
|
if (!(lc->out = open_error_file(lc->in)))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
table = dm_parse(extract_line, lc, parse_error, lc);
|
table = dm_parse(extract_line, lc, parse_error, lc);
|
||||||
|
|
||||||
/* if there was an error we have to close
|
close_error_file(lc->out);
|
||||||
the .err file */
|
|
||||||
if (lc->out)
|
|
||||||
close_error_file(lc->out);
|
|
||||||
|
|
||||||
kfree(lc);
|
kfree(lc);
|
||||||
inode->u.generic_ip = table;
|
inode->u.generic_ip = table;
|
||||||
|
Loading…
Reference in New Issue
Block a user