9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Alex Musolino <musolinoa@gmail.com>
To: 9front@9front.org
Subject: Re: [9front] pipe: bug or feature?
Date: Tue, 28 Mar 2017 12:57:03 +1030	[thread overview]
Message-ID: <CAMVULc591M5Bt6p4fG9a8-sE1Sa=G9WJu+saFwQgmauXPTR_9A@mail.gmail.com> (raw)
In-Reply-To: <BFB26C2F-FDF7-4118-B2BD-373750346B2E@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 333 bytes --]

>
> is this a bug or a feature of pipe?
>

It is a bug in your code.  When you do buf[n] = 0 in the last while
loop, you are writing past the end of buf.  This causes pfd[0] to
become 0 and so the next read is actually from stdin.  Making buf
larger "fixes" the problem because n=256 becomes a valid index.

--
Cheers,
Alex Musolino

[-- Attachment #2: Type: text/html, Size: 687 bytes --]

  reply	other threads:[~2017-03-28  2:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  1:42 arisawa
2017-03-28  2:27 ` Alex Musolino [this message]
2017-03-28  3:33   ` [9front] " arisawa

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='CAMVULc591M5Bt6p4fG9a8-sE1Sa=G9WJu+saFwQgmauXPTR_9A@mail.gmail.com' \
    --to=musolinoa@gmail.com \
    --cc=9front@9front.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).