9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Don Bailey <don.bailey@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] lpdaemon
Date: Wed,  5 Jun 2013 08:29:25 -0600	[thread overview]
Message-ID: <6E52B34A-D48E-4656-9B28-09B3363560CA@gmail.com> (raw)
In-Reply-To: <d408485f231154579a59a0bd31e0a99c@kw.quanstro.net>

You get that I'm talking about the subsequent read back after copy, right? No need to be so competitive :)

Also, you're making strange presumptions about me having presumptions. I'm not trying to say you're wrong or a poor coder, Erik. I was simply offering my point of view.

Before this thread dissolves into typical Plan 9 waste I'll admit that my first mistake was to make the poor decision to reply to a 9fans email. 

D

On Jun 5, 2013, at 8:09 AM, erik quanstrom <quanstro@quanstro.net> wrote:

>> You're absolutely correct if the length of value to be copied is not
>> validated prior to the copy.  Then, an invalid page could be hit if no
>> nil is present within the array or beyond.
> 
> wrong.  strncpy only copies up to the specified maximum.
> the code is ugly but correct.
> 
>> To be verbose, my bypassing of strncpy is due to issues I've
>> encountered in multi-threaded code.  e.g.  Don't trust libc copy
>> functions in MT envs, always check post call.
> 
> this sounds like your saying that because you had trouble in
> a multithreaded unix application, then without examining the
> code at hand, it is pronounced to have the same issue.
> 
> that sounds like equivocation to me.  the code is correct.
> and in all cases nul-terminated, and any unused bytes are
> 0.
> 
> i only object to strncpy because it requires extra work. seprint,
> snprint are a bit heavy weight but tend to produce cleaner looking
> code.  ymmv.
> 
> - erik
> 



      reply	other threads:[~2013-06-05 14:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 11:38 yaroslav
2013-06-05 13:06 ` erik quanstrom
2013-06-05 13:13 ` Don Bailey
2013-06-05 13:20   ` erik quanstrom
2013-06-05 13:40     ` Don Bailey
2013-06-05 13:38   ` Friedrich Psiorz
2013-06-05 13:54     ` Don Bailey
2013-06-05 14:09       ` erik quanstrom
2013-06-05 14:29         ` Don Bailey [this message]

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=6E52B34A-D48E-4656-9B28-09B3363560CA@gmail.com \
    --to=don.bailey@gmail.com \
    --cc=9fans@9fans.net \
    /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).