X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fcommon%2Fserial.c;h=3395c3e058e7b49203510f27060586a428df0e86;hb=38ba2522516b481fa3619bdec56d1e2a4b7a5f45;hp=9ab3169ce03af451a9d3474530eda5fa8ac36895;hpb=926b866cb624cebf2efca098088dba11afa8ae96;p=libsigrok.git diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 9ab3169c..3395c3e0 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -60,12 +60,11 @@ GSList *list_serial_ports(void) ports = NULL; for (i = 0; serial_port_glob[i]; i++) { - if (!glob(serial_port_glob[i], 0, NULL, &g)) { - for (j = 0; j < g.gl_pathc; j++) - ports = g_slist_append(ports, - strdup(g.gl_pathv[j])); - globfree(&g); - } + if (glob(serial_port_glob[i], 0, NULL, &g)) + continue; + for (j = 0; j < g.gl_pathc; j++) + ports = g_slist_append(ports, strdup(g.gl_pathv[j])); + globfree(&g); } return ports;