lkml.org 
[lkml]   [2012]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/4] fs, proc: Introduce /proc/<pid>/task/<tid>/children entry v8
On Tue, Jan 24, 2012 at 11:07:30AM +0900, KAMEZAWA Hiroyuki wrote:
...
>
> From viewpoint I played with seq_file, yesterday.
>
> > +static void *children_seq_start(struct seq_file *seq, loff_t *pos)
> > +{
> > + return get_children_pid(seq->private, NULL, *pos);
> > +}
> > +
> > +static void *children_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> > +{
> > + struct pid *pid = NULL;
> > +
> > + pid = get_children_pid(seq->private, v, *pos + 1);
> > + if (!pid)
> > + seq_printf(seq, "\n");
> > + put_pid(v);
>
> Because seq_printf() may fail. This seems dangeorus.
>
> If seq_printf() fails and returns NULL, "\n" will not be
> printed out and user land parser will go wrong.
>

Hmm. But userspace app will get eof, so frankly I don't see
a problem here. Or maybe I miss something?

> I think all seq_printf() should be handled in ->show().
> (And you can use seq_putc() for "\n".)
>

Sure, i'll change it to seq_putc.

Cyrill


\
 
 \ /
  Last update: 2012-01-24 07:57    [W:0.121 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site