mirror of
https://github.com/ksherlock/mpw-tools.git
synced 2024-11-01 03:06:12 +00:00
commit
1a9185959f
17
Duplicate.c
17
Duplicate.c
@ -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)
|
||||
{
|
||||
// no resource fork
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user