From 33221277690e6ee30387c506c3f2b8237ed48efd Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 May 2009 22:43:34 -0700 Subject: [PATCH] scandir returns -1 on error In which case, the namelist is invalid, so don't look at it, and don't free it. Signed-off-by: Keith Packard --- aoview/aoview_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aoview/aoview_dev.c b/aoview/aoview_dev.c index a326ad73..33f7f8ec 100644 --- a/aoview/aoview_dev.c +++ b/aoview/aoview_dev.c @@ -91,7 +91,7 @@ usb_tty(char *sys) dir_filter_tty, alphasort); free(endpoint_full); - if (ntty) { + if (ntty > 0) { tty = aoview_fullname("/dev", namelist[0]->d_name + 4); free(namelist); return tty; -- 2.30.2