diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2014-11-21 16:31:29 +0100 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2014-11-21 16:31:29 +0100 |
commit | 75c87a1583834b725c89ec963fcd3ee3c4ea4284 (patch) | |
tree | cc03d50943f04f041efbfbf95326dd7def616be2 /src | |
parent | 5d20747c30be7e5d246db702a0bdb45d69e62bfe (diff) | |
download | 0xFFFF-75c87a1583834b725c89ec963fcd3ee3c4ea4284.tar.bz2 |
disk: Ignore '.' and '..' when listing directory
Diffstat (limited to 'src')
-rw-r--r-- | src/disk.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -55,6 +55,9 @@ int disk_open_dev(int maj, int min, int partition, int readonly) { 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 ) continue; |