Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow changing ownership and permission of the root node #14

Merged
merged 1 commit into from
May 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
allow changing ownership and permission of the root node
  • Loading branch information
josch committed Mar 23, 2020
commit 8e4b9ae6f051454953a80b8e64443bcea6c9cc46
12 changes: 12 additions & 0 deletions genext2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2193,6 +2193,18 @@ add2fs_from_file(filesystem *fs, uint32 this_nod, FILE * fh, uint32 fs_timestamp
continue;
}
mode &= FM_IMASK;
if (fs && strcmp(path, "/") == 0) {
// if the entry modifies the root node, don't call
// basename and dirname but chmod the root node
// directly
if (type != 'd') {
error_msg("device table line %d skipped: root node must be directory", lineno);
continue;
}
mode |= FM_IFDIR;
chmod_fs(fs, this_nod, mode, uid, gid);
continue;
}
path2 = strdup(path);
name = basename(path);
dir = dirname(path2);
Expand Down