[systemd-devel] [systemd-commits] 8 commits - src/shared src/test src/tmpfiles

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Apr 11 17:04:20 PDT 2015


On Fri, Apr 10, 2015 at 07:24:27AM -0700, Lennart Poettering wrote:
> +static void item_array_sort(ItemArray *a) {
> +
> +        /* Sort an item array, to enforce stable ordering in which we
> +         * apply things. */
> +
> +        if (a->count <= 1)
> +                return;
> +
> +        qsort(a->items, a->count, sizeof(Item), item_compare);
> +}
qsort_safe already does this... I'll push a change to use that instead.

> -        if (user && !streq(user, "-")) {
> +        if (!isempty(user) && !streq(user, "-")) {
I think this change is misleading. user/group/mode/age can either be
NULL or "-" or should be set to a valid value. It should not be possible
to set them to an empty string. (Not that the change causes any problems,
just commenting on the fact that the patch description implies that it
changes stuff, but I don't see that.)

Zbyszek

>                  const char *u = user;
>  
>                  r = get_user_creds(&u, &i.uid, NULL, NULL, NULL);
> @@ -1872,7 +1872,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
>                  i.uid_set = true;
>          }
>  
> -        if (group && !streq(group, "-")) {
> +        if (!isempty(group) && !streq(group, "-")) {
>                  const char *g = group;
>  
>                  r = get_group_creds(&g, &i.gid);
> @@ -1884,7 +1884,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
>                  i.gid_set = true;
>          }
>  
> -        if (mode && !streq(mode, "-")) {
> +        if (!isempty(mode) && !streq(mode, "-")) {
>                  const char *mm = mode;
>                  unsigned m;
>  
> @@ -1904,7 +1904,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
>                  i.mode = IN_SET(i.type, CREATE_DIRECTORY, CREATE_SUBVOLUME, TRUNCATE_DIRECTORY)
>                          ? 0755 : 0644;
>  
> -        if (age && !streq(age, "-")) {
> +        if (!isempty(age) && !streq(age, "-")) {
>                  const char *a = age;


More information about the systemd-devel mailing list