static int find_free_loopdev_no_control(int *retfd, char *namep)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
struct loop_info64 lo;
DIR *dir;
int fd = -1;
SYSERROR("Error opening /dev");
return -1;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
static int cgroup_rmdir(char *dirname)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
int saved_errno = 0;
DIR *dir;
int ret, failed=0;
return -1;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
struct stat mystat;
int rc;
static int cgroup_recursive_task_count(const char *cgroup_path)
{
DIR *d;
- struct dirent *dent_buf;
struct dirent *dent;
- ssize_t name_max;
int n = 0, r;
- /* see man readdir_r(3) */
- name_max = pathconf(cgroup_path, _PC_NAME_MAX);
- if (name_max <= 0)
- name_max = 255;
- dent_buf = malloc(offsetof(struct dirent, d_name) + name_max + 1);
- if (!dent_buf)
- return -1;
-
d = opendir(cgroup_path);
- if (!d) {
- free(dent_buf);
+ if (!d)
return 0;
- }
- while (readdir_r(d, dent_buf, &dent) == 0 && dent) {
+ while ((dent = readdir(d))) {
const char *parts[3] = {
cgroup_path,
dent->d_name,
sub_path = lxc_string_join("/", parts, false);
if (!sub_path) {
closedir(d);
- free(dent_buf);
return -1;
}
r = stat(sub_path, &st);
if (r < 0) {
closedir(d);
- free(dent_buf);
free(sub_path);
return -1;
}
free(sub_path);
}
closedir(d);
- free(dent_buf);
return n;
}
static int cgroup_rmdir(char *dirname)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
DIR *dir;
int r = 0;
if (!dir)
return -1;
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
struct stat mystat;
char *pathname;
static int recursive_count_nrtasks(char *dirname)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
DIR *dir;
int count = 0, ret;
char *path;
if (!dir)
return 0;
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
struct stat mystat;
if (!direntp)
static int mount_rootfs_file(const char *rootfs, const char *target,
const char *options)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
struct loop_info64 loinfo;
int ret = -1, fd = -1, rc;
DIR *dir;
return -1;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
DIR *dir;
char path[MAXPATHLEN];
int ret = -1, len;
return -1;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
const char *fnam;
if (!direntp)
break;
static bool am_single_threaded(void)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
DIR *dir;
int count=0;
return false;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
static bool has_snapshots(struct lxc_container *c)
{
char path[MAXPATHLEN];
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
int count=0;
DIR *dir;
dir = opendir(path);
if (!dir)
return false;
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
{
char snappath[MAXPATHLEN], path2[MAXPATHLEN];
int count = 0, ret;
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
struct lxc_snapshot *snaps =NULL, *nsnaps;
DIR *dir;
return 0;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
static bool remove_all_snapshots(const char *path)
{
DIR *dir;
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
bool bret = true;
dir = opendir(path);
SYSERROR("opendir on snapshot path %s", path);
return false;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
if (!strcmp(direntp->d_name, "."))
{
DIR *dir;
int i, cfound = 0, nfound = 0;
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
struct lxc_container *c;
if (!lxcpath)
if (names)
*names = NULL;
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
*/
int lxc_check_inherited(struct lxc_conf *conf, bool closeall, int fd_to_ignore)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
int fd, fddir;
DIR *dir;
fddir = dirfd(dir);
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
if (!direntp)
break;
static int _recursive_rmdir(char *dirname, dev_t pdev,
const char *exclude, int level, bool onedev)
{
- struct dirent dirent, *direntp;
+ struct dirent *direntp;
DIR *dir;
int ret, failed=0;
char pathname[MAXPATHLEN];
return -1;
}
- while (!readdir_r(dir, &dirent, &direntp)) {
+ while ((direntp = readdir(dir))) {
struct stat mystat;
int rc;