View | Details | Raw Unified | Return to bug 64430
Collapse All | Expand All

(-)mv-new/mv.c (+24 lines)
Lines 212-217 Link Here
212
		struct statfs sfs;
212
		struct statfs sfs;
213
		char path[PATH_MAX];
213
		char path[PATH_MAX];
214
214
215
		/* If the source is a symbolic link and is on another
216
		 * filesystem, it can be recreated at the destination.
217
		 */
218
		if (lstat(from, &sb) == -1) {
219
		  warn("%s",from);
220
		  return (1);
221
		}
222
		if (S_ISLNK(sb.st_mode)) {
223
		  bzero(path, PATH_MAX);
224
		  if (readlink(from, path, PATH_MAX) == -1) {
225
		    warn("%s", from);
226
		    return (1);
227
		  }
228
		  if (symlink(path,to)==-1) {
229
		    warn("%s", to);
230
		    return (1);
231
		  }
232
		  if (unlink(from) == -1) {
233
		    warn("%s", from);
234
		    return (1);
235
		  }
236
		  return (0);
237
		}
238
215
		/* Can't mv(1) a mount point. */
239
		/* Can't mv(1) a mount point. */
216
		if (realpath(from, path) == NULL) {
240
		if (realpath(from, path) == NULL) {
217
			warnx("cannot resolve %s: %s", from, path);
241
			warnx("cannot resolve %s: %s", from, path);

Return to bug 64430