int success = 0;
if (conf->dryrun) {
- printf("chmod %o %s\n", item->mode, item->dest);
+ if (item->ftype != 'l') {
+ printf("chmod %o %s\n", item->mode, item->dest);
+ }
if (conf->setuser && conf->setgroup) {
- printf("chown %d:%d %s\n", item->uid, item->gid,
+ printf("lchown %d:%d %s\n", item->uid, item->gid,
item->dest);
}
printf("mtime %.0f %s\n", (double)item->mtime, item->dest);
return success;
}
- rv = chmod(item->dest, item->mode);
+ /* can't chmod a symlink */
+ if (item->ftype != 'l') {
+ rv = chmod(item->dest, item->mode);
- if (rv == -1) {
- setsyserr(conf, "can't chmod %o %s", item->mode, item->dest);
- return conf->errabort;
+ if (rv == -1) {
+ setsyserr(conf, "can't chmod %o %s", item->mode, item->dest);
+ return conf->errabort;
+ }
}
if (conf->setuser && conf->setgroup) {
- rv = chown(item->dest, item->uid, item->gid);
+ rv = lchown(item->dest, item->uid, item->gid);
if (rv == -1) {
- setsyserr(conf, "can't chown %s", item->dest);
+ setsyserr(conf, "can't lchown %s", item->dest);
return conf->errabort;
}
}
printf("rmdir %s\n", item->dest);
}
- printf("install %c%o %d:%d %s\n", item->ftype,
+ printf("install %c%o %d:%d %s", item->ftype,
item->mode, item->uid, item->gid,
item->dest);
+ if (item->ftype == 'l') {
+ printf(" -> %s", item->target);
+ }
+ printf("\n");
fflush(stdout);
return success;
}