Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: perex@perex.cz
Cc: alsa-devel@alsa-project.org
Subject: recent change in seqmid.c is broken?
Date: Mon, 14 Apr 2025 17:44:06 +0200	[thread overview]
Message-ID: <87friawxx5.wl-tiwai@suse.de> (raw)

Hi Jaroslav,

I'm afraid that your recent fix for alsa-lib commit a4e47461eca1
doesn't work as expected:

```
@@ -664,15 +663,11 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
                                break;
                        }
 
-                       if (!*bp->name)
+                       if (bp->name[0] == '\0')
                                continue;
-                       len = strlen(blknames);
-                       if (len)
-                               snprintf(blknames + len, sizeof(blknames) - len,
-                                        ", %s", bp->name);
-                       else
-                               snd_strlcpy(blknames, (const char *)bp->name,
-                                           sizeof(blknames));
+                       if (blknames[0])
+                               snd_strlcpy(blknames, ", ", sizeof(blknames));
+                       snd_strlcpy(blknames, (const char *)bp->name, sizeof(blknames));
                }
 
                if (!*blknames)
```

The original code appended the new bp->name string with the prefix of
", " if blknames is already present, but the new code looks as if it
overwrites onto blknames with strlcpy() from scratch for each
bp->name.

FWIW, the code there used to be with strlcat(), but it was rewritten
in the way above because strlcat() isn't always available in commit
d9694398130c.


thanks,

Takashi

             reply	other threads:[~2025-04-14 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 15:44 Takashi Iwai [this message]
2025-04-14 16:45 ` recent change in seqmid.c is broken? Jaroslav Kysela
2025-04-14 17:13   ` Jaroslav Kysela
2025-04-15  5:39   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87friawxx5.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox