disk: Ignore '.' and '..' when listing directory

This commit is contained in:
Pali Rohár committed 2014-11-21 16:31:29 +01:00
1 parent 5d20747c30
commit 75c87a1583
1 file changed
+3
+3
View File
@@ -55,6 +55,9 @@ int disk_open_dev(int maj, int min, int partition, int readonly) {
while ( ( dirent = readdir(dir) ) ) { while ( ( dirent = readdir(dir) ) ) {
if ( strncmp(dirent->d_name, ".", sizeof(".")) == 0 || strncmp(dirent->d_name, "..", sizeof("..")) == 0 )
continue;
if ( snprintf(blkdev, sizeof(blkdev), "/dev/%s", dirent->d_name) <= 0 ) if ( snprintf(blkdev, sizeof(blkdev), "/dev/%s", dirent->d_name) <= 0 )
continue; continue;