Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Skip device if parent is a file and not a dir
Browse files Browse the repository at this point in the history
  • Loading branch information
zestrada committed Jan 12, 2023
1 parent 3b99f4a commit a916fc7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions genext2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2629,6 +2629,8 @@ add2fs_from_file(filesystem *fs, uint32 this_nod, FILE * fh, uint32 fs_timestamp
size_t len;
struct stat st;
int nbargs, lineno = 0;
nod_info *ni;
inode *pnode;

fstat(fileno(fh), &st);
ctime = fs_timestamp;
Expand Down Expand Up @@ -2684,6 +2686,14 @@ add2fs_from_file(filesystem *fs, uint32 this_nod, FILE * fh, uint32 fs_timestamp
{
error_msg("device table line %d skipped: can't find directory '%s' to create '%s''", lineno, dir, name);
continue;
} else {
pnode = get_nod(fs, nod, &ni);
if((pnode->i_mode & FM_IFMT) != FM_IFDIR) {
error_msg("device table line %d skipped: parent '%s' is not a directory so won't create '%s''", lineno, dir, name);
put_nod(ni);
continue;
}
put_nod(ni);
}
}
else
Expand Down

0 comments on commit a916fc7

Please sign in to comment.