recent change in seqmid.c is broken?

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

 



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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux