|
|
@ -358,18 +358,8 @@ void CommandListener::AsecCmd::listAsecsInDirectory(SocketClient *cli, const cha
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t dirent_len = offsetof(struct dirent, d_name) +
|
|
|
|
dirent* dent;
|
|
|
|
fpathconf(dirfd(d), _PC_NAME_MAX) + 1;
|
|
|
|
while ((dent = readdir(d)) != NULL) {
|
|
|
|
|
|
|
|
|
|
|
|
struct dirent *dent = (struct dirent *) malloc(dirent_len);
|
|
|
|
|
|
|
|
if (dent == NULL) {
|
|
|
|
|
|
|
|
cli->sendMsg(ResponseCode::OperationFailed, "Failed to allocate memory", true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct dirent *result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (!readdir_r(d, dent, &result) && result != NULL) {
|
|
|
|
|
|
|
|
if (dent->d_name[0] == '.')
|
|
|
|
if (dent->d_name[0] == '.')
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
if (dent->d_type != DT_REG)
|
|
|
|
if (dent->d_type != DT_REG)
|
|
|
@ -384,8 +374,6 @@ void CommandListener::AsecCmd::listAsecsInDirectory(SocketClient *cli, const cha
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(d);
|
|
|
|
closedir(d);
|
|
|
|
|
|
|
|
|
|
|
|
free(dent);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CommandListener::AsecCmd::runCommand(SocketClient *cli,
|
|
|
|
int CommandListener::AsecCmd::runCommand(SocketClient *cli,
|
|
|
|