From cf325a27769a3e01aecf726ef42d67ac15f1614c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 20 Jun 2014 15:35:26 +0200 Subject: Add check for readdir for DT_UNKNOWN --- src/mot-encoder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp index e227412..cc451e6 100644 --- a/src/mot-encoder.cpp +++ b/src/mot-encoder.cpp @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) while(1) { pDir = opendir(dir); if (pDir == NULL) { - printf ("Cannot open directory '%s'\n", dir); + fprintf(stderr, "Cannot open directory '%s'\n", dir); return 1; } if (fidx == 9999) { @@ -226,7 +226,7 @@ int main(int argc, char *argv[]) } while ((pDirent = readdir(pDir)) != NULL) { - if (pDirent->d_name[0] != '.') { + if (pDirent->d_type != DT_UNKNOWN && pDirent->d_name[0] != '.') { sprintf(imagepath, "%s/%s", dir, pDirent->d_name); ret = encodeFile(output_fd, imagepath, fidx, padlen); if (ret != 1) { -- cgit v1.2.3