NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PR/59838 CVS commit: src/usr.sbin/mtree




> On Dec 19, 2025, at 9:15 AM, Jose Luis Duran via gnats <gnats-admin%netbsd.org@localhost> wrote:
> 
> The following reply was made to PR bin/59838; it has been noted by GNATS.
> 

[stuff deleted]

> I believe it should also check for the presence of F_TYPE before
> printing "/set":
> 
> --- a/usr.sbin/mtree/create.c
> +++ b/usr.sbin/mtree/create.c
> @@ -396,16 +396,20 @@ statd(FILE *fp, FTS *t, FTSENT *parent, uid_t
> *puid, gid_t *pgid, mode_t *pmode,
>          * output a new one.  So first we check to see if anything changed.
>          * Note that we always output a /set record for the first directory.
>          */
> -       if (((keys & (F_UNAME | F_UID)) && (*puid != saveuid)) ||
> +       if ((keys & F_TYPE) ||
> +           ((keys & (F_UNAME | F_UID)) && (*puid != saveuid)) ||
>             ((keys & (F_GNAME | F_GID)) && (*pgid != savegid)) ||
> -           ((keys & F_MODE) && (*pmode != savemode)) ||
> +           ((keys & F_MODE) && (*pmode != savemode)) ||
>             ((keys & F_FLAGS) && (*pflags != saveflags)) ||
>             first) {
>                 first = 0;
> -               if (flavor != F_NETBSD6 && dflag)
> -                       fprintf(fp, "/set type=dir");
> -               else
> -                       fprintf(fp, "/set type=file");
> +               fprintf(fp, "/set");
> +               if (keys & F_TYPE) {
> +                       if (flavor != F_NETBSD6 && dflag)
> +                               fprintf(fp, " type=dir");
> +                       else
> +                               fprintf(fp, " type=file");
> +               }
>                 if (keys & (F_UID | F_UNAME)) {
>                         if (keys & F_UNAME &&
>                             (name = user_from_uid(saveuid, 1)) != NULL)
> 

We do we need to check F_TYPE twice? It is in the outer if...


christos

Attachment: signature.asc
Description: Message signed with OpenPGP



Home | Main Index | Thread Index | Old Index