mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 00:31:16 +00:00
shrink the code a bit
This commit is contained in:
parent
53d57dbe6b
commit
248d2220f9
@ -170,15 +170,13 @@ end:
|
|||||||
static void find_dev(char *path)
|
static void find_dev(char *path)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
int len=strlen(path);
|
size_t len=strlen(path);
|
||||||
|
struct dirent *entry;
|
||||||
|
|
||||||
if (!(dir = opendir(path)))
|
if ((dir = opendir(path)) == NULL)
|
||||||
bb_perror_msg_and_die("No %s",path);
|
return;
|
||||||
|
|
||||||
for (;;) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
struct dirent *entry = readdir(dir);
|
|
||||||
|
|
||||||
if (!entry) break;
|
|
||||||
|
|
||||||
/* Skip "." and ".." (also skips hidden files, which is ok) */
|
/* Skip "." and ".." (also skips hidden files, which is ok) */
|
||||||
|
|
||||||
@ -187,7 +185,6 @@ static void find_dev(char *path)
|
|||||||
if (entry->d_type == DT_DIR) {
|
if (entry->d_type == DT_DIR) {
|
||||||
snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
|
snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
|
||||||
find_dev(path);
|
find_dev(path);
|
||||||
path[len] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's a dev entry, mknod it */
|
/* If there's a dev entry, mknod it */
|
||||||
|
Loading…
Reference in New Issue
Block a user