[systemd-devel] [PATCHv6] tmpfiles, man: Add xattr support to tmpfiles

Lennart Poettering lennart at poettering.net
Wed Nov 12 05:20:22 PST 2014


On Wed, 12.11.14 14:01, Maciej Wereski (m.wereski at partner.samsung.com) wrote:

> >>+        p = i->argument;
> >>+
> >>+        while ((n = unquote_first_word(&p, &xattr)) > 0) {
> >>+                if (strv_extend(&i->xattrs, xattr) < 0)
> >>+                        return log_oom();
> >>+                free(xattr);
> >>+                xattr = NULL;
> >>+        }
> >
> >Please use strv_consume() or strv_push() here, to make the additional
> >copy unnecessary. Also please, generate a parse failure if
> >unquote_first_workd() fails due to parse errors.
> 
> What does it mean parse failure? I'm passing return value of
> unquote_first_word(). Should it be something else?

No just the return value, that is all. I missed that you already
handle this. Sorry for the confusion!

> >>+                if (i->type == CREATE_SYMLINK) {
> >>+                        if (lsetxattr(path, name, value, n+1, 0) < 0) {
> >>+                                log_error("Setting extended attribute
> >>%s=%s on symlink %s failed: %m", name, value, path);
> >>+                                return -errno;
> >>+                        }
> >>+                }
> >>+                else if (setxattr(path, name, value, n+1, 0) < 0) {
> >>+                        log_error("Setting extended attribute %s=%s on
> >>%s failed: %m", name, value, path);
> >>+                        return -errno;
> >>+                }
> >
> >The indentation is wrong.
> >[cut]
> 
> Hmm? I'm using systemd .vimrc, so what is wrong with indentation here
> precisely?


this is correct:

        if (...) {
        } else if (...) {
        }

this is not:

        if (...) {
        }
        else if (...) {
        }

according to our CODING_STYLE guideliness.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list