1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-27 08:00:11 +00:00

When trying to emulate a cross-device move operation with cp and rm, add

a "--" argument after the options so filenames with leading dashes are
handled correctly.

PR:		39318
Submitted by:	Serge van den Boom <svdb@stack.nl>
MFC after:	1 week
This commit is contained in:
Tim J. Robbins 2002-06-16 04:06:58 +00:00
parent c9cb13a07b
commit 9a81395d08
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98280

View File

@ -336,7 +336,7 @@ copy(char *from, char *to)
int pid, status;
if ((pid = fork()) == 0) {
execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", from, to,
execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", "--", from, to,
(char *)NULL);
warn("%s", _PATH_CP);
_exit(1);
@ -355,7 +355,7 @@ copy(char *from, char *to)
return (1);
}
if (!(pid = vfork())) {
execl(_PATH_RM, "mv", "-rf", from, (char *)NULL);
execl(_PATH_RM, "mv", "-rf", "--", from, (char *)NULL);
warn("%s", _PATH_RM);
_exit(1);
}