Suppress Duplicate's useless error message

This commit is contained in:
USHIRODA, Atsushi 2017-11-23 11:02:38 +09:00
parent 45525bed6e
commit d74c8d0d6e
1 changed files with 14 additions and 3 deletions

View File

@ -151,13 +151,23 @@ int copyFork(const char *src, const char *dest, unsigned fork)
fork = fork ? O_RSRC : 0;
rfd = open(src, O_RDONLY | O_BINARY | fork);
rfd = open(src, O_RDONLY | O_BINARY);
if (rfd < 0)
{
fprintf(stderr, "Error opening %s: %s\n", src, strerror(errno));
return -1;
}
if (fork) {
close(rfd);
rfd = open(src, O_RDONLY | O_BINARY | fork);
if (rfd < 0)
{
fprintf(stderr, "No resource fork %s\n", src);
return 0;
}
}
// no 3rd parameter to open.
wfd = open(dest, O_WRONLY | O_BINARY | O_CREAT |O_TRUNC| fork);
if (wfd < 0)
@ -320,7 +330,8 @@ int main(int argc, char **argv)
fprintf(stderr, "Error: directory destination is not yet supported.\n");
exit(1);
}
if (m == 0 && opts['r' - 'a'])
// if (m == 0 && opts['r' - 'a'])
if (m == 0)
{
// workaround to create the file if
// only copying the resource fork.
@ -374,4 +385,4 @@ int main(int argc, char **argv)
}
return ok;
}
}