]> pd.if.org Git - zpackage/commitdiff
skip chmod on symlinks
authorNathan Wagner <nw@hydaspes.if.org>
Sun, 4 Nov 2018 21:45:24 +0000 (21:45 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sun, 4 Nov 2018 21:45:24 +0000 (21:45 +0000)
zpm-syncfs.c

index 06477f172563c84b4b9ec0f24d357481178e352f..d21f34f3551bc97558a6afe6a40e660f60349e23 100644 (file)
@@ -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) {