]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: fix return value when failing devnode detection of ALSA Sequencer character...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 12 Jul 2025 08:00:06 +0000 (17:00 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 12 Jul 2025 12:31:59 +0000 (21:31 +0900)
When failing detecting devnode of ALSA Sequencer character device, the
helper function returns negative value to the callers. This is overlooked
in the previous code refactoring. It should return FALSE.

This bug brings the following compiler warnings:

../src/seq/query.c: In function ‘alsaseq_get_system_info’:
../src/seq/query.c:113:9: warning: ‘fd’ may be used uninitialized [-Wmaybe-uninitialized]
  113 |     if (ioctl(fd, SNDRV_SEQ_IOCTL_SYSTEM_INFO, info) < 0) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/seq/query.c:101:9: note: ‘fd’ was declared here
  101 |     int fd;
      |

This commit fixes the bug.

Fixes: 31eb1a62345c ("seq: query: rewrite public API to return gboolean according to GNOME convention")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/query.c

index b49c99bb65063117bc43da52d062fe1e7e36493e..feddfda3f68beb9684b4fea96029e3c626cac683 100644 (file)
@@ -70,7 +70,7 @@ static gboolean open_fd(int *fd, GError **error)
     gboolean result;
 
     if (!alsaseq_get_seq_devnode(&devname, error))
-        return -1;
+        return FALSE;
 
     result = TRUE;
     *fd = open(devname, O_RDONLY);