commit 99f8222ce512794ae2883e6974b1394cd47bd68d from: Tobias Heider date: Mon Feb 16 10:53:48 2026 UTC Consistently use g_error commit - d9f741dce5483157626a854e21bf5fa420aada02 commit + 99f8222ce512794ae2883e6974b1394cd47bd68d blob - fe98fd44e9dc4af72d6fa6496fa294448ce850f5 blob + bb031259086c9e171b41a5eca086265879601798 --- siomixer.c +++ siomixer.c @@ -268,31 +268,25 @@ main (int argc, char **argv) g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); s.hdl = sioctl_open(devname, SIOCTL_READ | SIOCTL_WRITE, 0); - if (s.hdl == NULL) { - fprintf(stderr, "%s: can't open control device\n", devname); - exit(1); - } + if (s.hdl == NULL) + g_error("%s: can't open control device\n", devname); + s.store = g_list_store_new(SIOMIXER_TYPE_CTL_ITEM); /* Initial state */ - if (!sioctl_ondesc(s.hdl, ondesc, NULL)) { - fprintf(stderr, "sioctl_ondesc: can't get device description\n"); - exit(1); - } + if (!sioctl_ondesc(s.hdl, ondesc, NULL)) + g_error("sioctl_ondesc: can't get device description\n"); sioctl_onval(s.hdl, onctl, NULL); gs = g_source_new(&sioctl_source_funcs, sizeof(struct sioctl_source)); struct sioctl_source *ss = (struct sioctl_source *)gs; ss->pfds = calloc(sioctl_nfds(s.hdl), sizeof(struct pollfd)); - if (ss->pfds == NULL) { - perror("calloc"); - exit(1); - } + if (ss->pfds == NULL) + g_error("calloc"); ss->nfds = sioctl_pollfd(s.hdl, ss->pfds, POLLIN); - if (ss->nfds == 0) { - perror("sioctl_pollfd"); - exit(1); - } + if (ss->nfds == 0) + g_error("sioctl_pollfd"); + for (int i = 0; i < ss->nfds; i++) { if (fcntl(ss->pfds[i].fd, F_GETFL) == -1) g_error("Invalid FD");