Skip to content

Commit

Permalink
Add ordered directory traversal
Browse files Browse the repository at this point in the history
  • Loading branch information
mpolitzer committed Mar 22, 2023
1 parent 3b99f4a commit 7eca83d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT([genext2fs], [1.4.2])
AC_INIT([genext2fs], [1.5.1])
AC_CONFIG_SRCDIR([genext2fs.c])

builtin(include, [m4/ac_func_snprintf.m4])dnl
Expand Down
12 changes: 6 additions & 6 deletions genext2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2766,17 +2766,17 @@ add2fs_from_dir(filesystem *fs, uint32 this_nod, int squash_uids, int squash_per
uint32 uid, gid, mode, ctime, mtime;
const char *name;
FILE *fh;
DIR *dh;
struct dirent *dent;
struct dirent **dents = NULL;
struct stat st;
char *lnk;
uint32 save_nod;
uint32 save_nod, numdirs, i;
off_t filesize;

if(!(dh = opendir(".")))
if((numdirs = scandir(".", &dents, NULL, alphasort)) == -1)
perror_msg_and_die(".");
while((dent = readdir(dh)))
for (i = 0; i < numdirs; ++i)
{
struct dirent *dent = dents[i];
if((!strcmp(dent->d_name, ".")) || (!strcmp(dent->d_name, "..")))
continue;
lstat(dent->d_name, &st);
Expand Down Expand Up @@ -2907,7 +2907,7 @@ add2fs_from_dir(filesystem *fs, uint32 this_nod, int squash_uids, int squash_per
}
}
}
closedir(dh);
free(dents);
}

// Copy size blocks from src to dst, putting holes in the output
Expand Down

0 comments on commit 7eca83d

Please sign in to comment.