FreeBSD Bugzilla – Attachment 13077 Details for
Bug 25013
mv(1) cannot move unresolvable symlinks across devices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.68 KB, created by
mkamm
on 2001-02-11 22:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
mkamm
Created:
2001-02-11 22:50:01 UTC
Size:
1.68 KB
patch
obsolete
>Index: mv.c >=================================================================== >RCS file: /home/ncvs/src/bin/mv/mv.c,v >retrieving revision 1.27 >diff -u -r1.27 mv.c >--- mv.c 2000/07/20 18:30:00 1.27 >+++ mv.c 2001/02/10 03:51:23 >@@ -152,10 +152,11 @@ > do_move(from, to) > char *from, *to; > { >- struct stat sb; >- int ask, ch, first; >+ struct stat sb_from, sb; >+ int ask, ch, first, got_from; > char modep[15]; > >+ got_from = 0; /* lstat of "from" not done yet */ > /* > * Check access. If interactive and file exists, ask user if it > * should be replaced. Otherwise if file exists but isn't writable >@@ -164,10 +165,11 @@ > if (!fflg && !access(to, F_OK)) { > > /* prompt only if source exist */ >- if (lstat(from, &sb) == -1) { >+ if (lstat(from, &sb_from) == -1) { > warn("%s", from); > return (1); > } >+ got_from = 1; > > #define YESNO "(y/n [n]) " > ask = 0; >@@ -202,6 +204,14 @@ > struct statfs sfs; > char path[MAXPATHLEN]; > >+ /* if from isn't a directory it can't be a mount point */ >+ if (!got_from && lstat(from, &sb_from) == -1) { >+ warn("%s", from); >+ return (1); >+ } >+ if (!S_ISDIR(sb_from.st_mode)) >+ goto copy_it; >+ > /* Can't mv(1) a mount point. */ > if (realpath(from, path) == NULL) { > warnx("cannot resolve %s: %s", from, path); >@@ -221,12 +231,13 @@ > * it's a regular file, do the copy internally; otherwise, use > * cp and rm. > */ >- if (lstat(from, &sb)) { >+ if (!got_from && lstat(from, &sb_from)) { > warn("%s", from); > return (1); > } >- return (S_ISREG(sb.st_mode) ? >- fastcopy(from, to, &sb) : copy(from, to)); >+ copy_it: >+ return (S_ISREG(sb_from.st_mode) ? >+ fastcopy(from, to, &sb_from) : copy(from, to)); > } > > int
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 25013
: 13077