This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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? %m is another option. Thanks, Florian
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |