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

(-)utils.c (-2 / +27 lines)
Lines 224-230 Link Here
224
		warn("symlink: %s", link);
224
		warn("symlink: %s", link);
225
		return (1);
225
		return (1);
226
	}
226
	}
227
	return (0);
227
	return (pflag ? setlink(p->fts_statp) : 0);
228
}
228
}
229
229
230
int
230
int
Lines 305-311 Link Here
305
305
306
	if (!gotstat || fs->st_mode != ts.st_mode)
306
	if (!gotstat || fs->st_mode != ts.st_mode)
307
		if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {
307
		if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {
308
			warn("chown: %s", to.p_path);
308
			warn("chmod: %s", to.p_path);
309
			rval = 1;
309
			rval = 1;
310
		}
310
		}
311
311
Lines 318-323 Link Here
318
318
319
	return (rval);
319
	return (rval);
320
}
320
}
321
322
323
int
324
setlink(fs)
325
	struct stat *fs;
326
{
327
	struct stat ts;
328
329
	if (lstat(to.p_path, &ts)) {
330
	    warn("symlink %s disappeared", to.p_path);
331
	    return (1);
332
	}
333
	/*
334
	 * Changing the ownership probably won't succeed, unless we are root.
335
	 */
336
	if (fs->st_uid != ts.st_uid || fs->st_gid != ts.st_gid)
337
	    if (lchown(to.p_path, fs->st_uid, fs->st_gid)) {
338
		if (errno != EPERM) {
339
		    warn("lchown: %s", to.p_path);
340
		    return (1);
341
		}
342
	    }
343
	return (0);
344
}
345
321
346
322
void
347
void
323
usage()
348
usage()

Return to bug 25017