From: Nathan Wagner Date: Sun, 4 Nov 2018 21:45:24 +0000 (+0000) Subject: skip chmod on symlinks X-Git-Tag: v0.2.16~30 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=0b4c476faa9f0e5ce8d5c7363daa5e81d452814a skip chmod on symlinks --- diff --git a/zpm-syncfs.c b/zpm-syncfs.c index 06477f1..d21f34f 100644 --- a/zpm-syncfs.c +++ b/zpm-syncfs.c @@ -607,7 +607,9 @@ static int set_md(struct config *conf, struct nitem *item) { 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, item->dest); @@ -617,11 +619,14 @@ static int set_md(struct config *conf, struct nitem *item) { 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) {