unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: DJ Delorie <dj@redhat.com>,  libc-alpha@sourceware.org
Subject: Re: RFC V2 [1/2] test-in-container
Date: Wed, 28 Feb 2018 16:04:36 +0100	[thread overview]
Message-ID: <mvmvaehrw8r.fsf@suse.de> (raw)
In-Reply-To: <a5e758e3-1833-28e6-2dd2-fe22f2cff6ea@redhat.com> (Florian Weimer's message of "Wed, 28 Feb 2018 13:49:44 +0100")

On Feb 28 2018, Florian Weimer <fweimer@redhat.com> wrote:

> On 02/27/2018 10:09 PM, Andreas Schwab wrote:
>>> +static void
>>> +copy_one_file (const char *sname, const char *dname)
>>> +{
>>> +  int sfd, dfd;
>>> +  char buf[512];
>>> +  size_t rsz;
>>> +  struct stat st;
>>> +  struct utimbuf times;
>>> +
>>> +  sfd = open (sname, O_RDONLY);
>>> +  if (sfd < 0)
>>> +    {
>>> +      printf ("unable to open %s for reading\n", sname);
>>> +      perror ("the error was");
>
>> That doesn't work, the printf call can clobber errno.  Use error instead.
>
> Doesn't error print to standard error?

perror does, too.

> %m is another option.

Or strerror.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


  reply	other threads:[~2018-02-28 15:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 20:33 RFC V2 [1/2] test-in-container DJ Delorie
2018-02-27 21:09 ` Andreas Schwab
2018-02-27 21:17   ` DJ Delorie
2018-02-28 12:49   ` Florian Weimer
2018-02-28 15:04     ` Andreas Schwab [this message]
2018-02-28 12:56 ` Florian Weimer
2018-02-28 12:57 ` Florian Weimer

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=mvmvaehrw8r.fsf@suse.de \
    --to=schwab@linux-m68k.org \
    --cc=dj@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).