lkml.org 
[lkml]   [2015]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] string: provide strscpy() and strscpy_truncate()
On Thu, Apr 30, 2015 at 12:01:16PM -0400, Chris Metcalf wrote:
> +ssize_t strscpy(char *dest, const char *src, size_t count)
> +{
> + ssize_t res = strscpy_truncate(dest, src, count);
> + if (res < 0 && count != 0)
> + dest[0] = '\0';

How is this better than returning a truncated string? Is it just
because the caller was naughty so we give them a spanking?

> + return res;
> +}

regards,
dan carpenter


\
 
 \ /
  Last update: 2015-05-06 17:21    [W:0.238 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site