RFC V2 [1/2] test-in-container
Andreas Schwab
schwab@linux-m68k.org
Wed Feb 28 16:46:00 GMT 2018
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."
More information about the Libc-alpha
mailing list