aboutsummaryrefslogtreecommitdiff
path: root/jffsX-utils
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-24 23:18:18 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-09 22:13:18 +0100
commit4233a39933277b0d715d59d72942a8fd65bcec4a (patch)
treea7ef2db87b697d54c19ee03a115508b60f27f623 /jffsX-utils
parentb636250e211198210ab996671bccc2983300c6f5 (diff)
mtd-utils: Fix various TOCTOU issues
This patch restructures various code parts that follow the pattern of "stat(x, &sb) ... makes_sense(&sb) ... open(x)". Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'jffsX-utils')
-rw-r--r--jffsX-utils/mkfs.jffs2.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
index f46cc22..9cc5eaf 100644
--- a/jffsX-utils/mkfs.jffs2.c
+++ b/jffsX-utils/mkfs.jffs2.c
@@ -1772,9 +1772,7 @@ int main(int argc, char **argv)
}
out_fd = 1;
}
- if (lstat(rootdir, &sb)) {
- sys_errmsg_die("%s", rootdir);
- }
+
if (chdir(rootdir))
sys_errmsg_die("%s", rootdir);