lkml.org 
[lkml]   [2009]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH 2/8] breakout fdinfo sprintf() into its own function
From
Date
On Fri, 2009-02-27 at 21:56 +0100, Vegard Nossum wrote:
> > +static void proc_fd_write_info(struct file *file, char *info)
> > +{
> > + int max = PROC_FDINFO_MAX;
> > + int p = 0;
> > + if (!info)
> > + return;
> > +
> > + p += snprintf(info+p, max-p, "pos:\t%lli\n", (long long) file->f_pos);
> > + p += snprintf(info+p, max-p, "flags:\t0%o\n", file->f_flags);
>
> Actually, snprintf() is not the right function to use here.
> scnprintf(), perhaps?

Yes, that does look more appropriate. I'll double-check what happens
when we overrun the buffer.

-- Dave



\
 
 \ /
  Last update: 2009-02-27 22:25    [W:0.070 / U:1.088 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site