diff --git a/Sanity/basic/test_lockdev.c b/Sanity/basic/test_lockdev.c index 72ec1f8..80d3225 100644 --- a/Sanity/basic/test_lockdev.c +++ b/Sanity/basic/test_lockdev.c @@ -23,7 +23,10 @@ int main() { } while ((entry = readdir(dp))) { - if (strncmp(entry->d_name, "ttyS", 4) == 0) { + if (strncmp(entry->d_name, "tty", 3) == 0 && + strcmp(entry->d_name, "tty") != 0 && + strcmp(entry->d_name, "tty0") != 0) { + snprintf(device, sizeof(device), "%s%s", DEVICE_PATH, entry->d_name); break; } @@ -32,7 +35,7 @@ int main() { closedir(dp); if (entry == NULL) { - fprintf(stderr, "No tty device found ttyS*\n"); + fprintf(stderr, "No suitable tty device found (excluding tty and tty0)\n"); return 1; }