linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Sebastian Herbszt <herbszt@gmx.de>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	James Smart <James.Smart@Emulex.Com>
Subject: Re: [PATCH] lpfc: fix model description
Date: Mon, 27 Apr 2015 08:02:53 +0200	[thread overview]
Message-ID: <553DD10D.8060407@sandisk.com> (raw)
In-Reply-To: <20150427003211.0000410a@localhost>

On 04/27/15 00:32, Sebastian Herbszt wrote:
> Bart Van Assche wrote:
>> * Switch from snprintf() to scnprintf() because the latter function
>>     guarantees '\0'-termination if the output has to be truncated.
>
> Doesn't snprintf() guarantee this too? The only difference between
> snprintf() and scnprintf() seems to be the return value.
> snprintf() calls vsnprintf() and scnprintf() calls vscnprintf() which
> calls vsnprintf() itself.

Hello Sebastian,

In my e-mail I was referring to the pre-C99 behavior of snprintf(). 
Apparently the snprintf() function in the Linux kernel is compliant with 
the C99 specs. See e.g. 
http://pubs.opengroup.org/onlinepubs/7908799/xsh/fprintf.html and 
http://pubs.opengroup.org/stage7tc1/functions/fprintf.html#. In the 
latter document it has been mentioned that "output bytes beyond the 
n-1st shall be discarded", something which has not been mentioned in the 
former document.

Bart.

  reply	other threads:[~2015-04-27  6:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 21:16 [PATCH] lpfc: fix model description Sebastian Herbszt
2015-04-23  7:36 ` Bart Van Assche
2015-04-26 22:32   ` Sebastian Herbszt
2015-04-27  6:02     ` Bart Van Assche [this message]
2015-05-27 21:40 ` Sebastian Herbszt
2015-05-28 20:28   ` James Smart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553DD10D.8060407@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=James.Smart@Emulex.Com \
    --cc=herbszt@gmx.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).