This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC V2 [1/2] test-in-container
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: DJ Delorie <dj at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 27 Feb 2018 22:09:41 +0100
- Subject: Re: RFC V2 [1/2] test-in-container
- Authentication-results: sourceware.org; auth=none
- References: <xnwoyyrx3c.fsf@greed.delorie.com>
On Feb 27 2018, DJ Delorie <dj@redhat.com> 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.
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."