From 350865e33979bdd2a5005939c214fb3d9f4bbc9d Mon Sep 17 00:00:00 2001 From: "\"Vladimir N. Oleynik\"" Date: Sat, 26 Nov 2005 11:01:23 +0000 Subject: [PATCH] remove bug: fsck do not know path --- e2fsprogs/fsck.c | 4 +--- e2fsprogs/fsck.h | 2 +- e2fsprogs/util.c | 12 +++++++----- e2fsprogs/util.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 7f7ab3eb3..848d559bc 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -1361,7 +1361,7 @@ int fsck_main(int argc, char *argv[]) fstab = _PATH_MNTTAB; load_fs_info(fstab); - e2fs_set_sbin_path(); + fsck_path = e2fs_set_sbin_path(); if ((num_devices == 1) || (serialize)) interactive = 1; @@ -1405,8 +1405,6 @@ int fsck_main(int argc, char *argv[]) } } status |= wait_many(FLAG_WAIT_ALL); - if (ENABLE_FEATURE_CLEAN_UP) - free(fsck_path); blkid_put_cache(cache); return status; } diff --git a/e2fsprogs/fsck.h b/e2fsprogs/fsck.h index bd22fbb24..8ae8f427a 100644 --- a/e2fsprogs/fsck.h +++ b/e2fsprogs/fsck.h @@ -13,4 +13,4 @@ #define FSCK_CANCELED 32 /* Aborted with a signal or ^C */ #define EXIT_LIBRARY 128 -extern void e2fs_set_sbin_path(void); +extern char *e2fs_set_sbin_path(void); diff --git a/e2fsprogs/util.c b/e2fsprogs/util.c index e59b18c5a..7e9c09234 100644 --- a/e2fsprogs/util.c +++ b/e2fsprogs/util.c @@ -254,13 +254,15 @@ void make_journal_blocks(ext2_filsys fs, int journal_size, int journal_flags, in puts("done"); } -void e2fs_set_sbin_path(void) +char *e2fs_set_sbin_path(void) { char *oldpath = getenv("PATH"); /* Update our PATH to include /sbin */ #define PATH_SET "/sbin" - if (oldpath) - putenv (bb_xasprintf("%s:%s", PATH_SET, oldpath)); - else - putenv (PATH_SET); + if (oldpath) + oldpath = bb_xasprintf("%s:%s", PATH_SET, oldpath); + else + oldpath = PATH_SET; + putenv (oldpath); + return oldpath; } diff --git a/e2fsprogs/util.h b/e2fsprogs/util.h index 4634b08dd..24d5e6545 100644 --- a/e2fsprogs/util.h +++ b/e2fsprogs/util.h @@ -18,4 +18,4 @@ extern int figure_journal_size(int size, ext2_filsys fs); extern void print_check_message(ext2_filsys fs); extern void make_journal_device(char *journal_device, ext2_filsys fs, int quiet, int force); extern void make_journal_blocks(ext2_filsys fs, int journal_size, int journal_flags, int quiet); -extern void e2fs_set_sbin_path(void); +extern char *e2fs_set_sbin_path(void); -- 2.25.1