fsck: use PATH or fallback to /sbin
It's overkill to support all the obscure paths like /sbin/fs.d. We have PATH for customization, that's enough. It still seems like a good idea to keep fsck robust, because it's used by boot scripts/systemd. For this reason fsck fallbacks to "/sbin" if PATH is undefined or empty. Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
f1bc59963f
commit
a03bdbcd20
|
@ -80,14 +80,11 @@ In actuality,
|
||||||
.B fsck
|
.B fsck
|
||||||
is simply a front-end for the various filesystem checkers
|
is simply a front-end for the various filesystem checkers
|
||||||
(\fBfsck\fR.\fIfstype\fR) available under Linux. The
|
(\fBfsck\fR.\fIfstype\fR) available under Linux. The
|
||||||
filesystem-specific checker is searched for in
|
filesystem-specific checker is searched for in the
|
||||||
.I /sbin
|
PATH environment variable. If the PATH is undefined then
|
||||||
first, then in
|
fallback to "/sbin".
|
||||||
.I /etc/fs
|
.PP
|
||||||
and
|
Please see the filesystem-specific checker manual pages for
|
||||||
.IR /etc ,
|
|
||||||
and finally in the directories listed in the PATH environment
|
|
||||||
variable. Please see the filesystem-specific checker manual pages for
|
|
||||||
further details.
|
further details.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
@ -416,17 +413,7 @@ be run based on gathering accounting data from the operating system.
|
||||||
.B PATH
|
.B PATH
|
||||||
The
|
The
|
||||||
.B PATH
|
.B PATH
|
||||||
environment variable is used to find filesystem checkers. A set of
|
environment variable is used to find filesystem checkers.
|
||||||
system directories are searched first:
|
|
||||||
.BR /sbin ,
|
|
||||||
.BR /sbin/fs.d ,
|
|
||||||
.BR /sbin/fs ,
|
|
||||||
.BR /etc/fs ,
|
|
||||||
and
|
|
||||||
.BR /etc .
|
|
||||||
Then the set of directories found in the
|
|
||||||
.B PATH
|
|
||||||
environment are searched.
|
|
||||||
.TP
|
.TP
|
||||||
.B FSTAB_FILE
|
.B FSTAB_FILE
|
||||||
This environment variable allows the system administrator
|
This environment variable allows the system administrator
|
||||||
|
|
|
@ -150,9 +150,10 @@ static int kill_sent;
|
||||||
static char *fstype;
|
static char *fstype;
|
||||||
static struct fsck_instance *instance_list;
|
static struct fsck_instance *instance_list;
|
||||||
|
|
||||||
static const char fsck_prefix_path[] = FS_SEARCH_PATH;
|
#define FSCK_DEFAULT_PATH "/sbin"
|
||||||
static char *fsck_path;
|
static char *fsck_path;
|
||||||
|
|
||||||
|
|
||||||
/* parsed fstab and mtab */
|
/* parsed fstab and mtab */
|
||||||
static struct libmnt_table *fstab, *mtab;
|
static struct libmnt_table *fstab, *mtab;
|
||||||
static struct libmnt_cache *mntcache;
|
static struct libmnt_cache *mntcache;
|
||||||
|
@ -1551,8 +1552,8 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, status = 0;
|
int i, status = 0;
|
||||||
int interactive = 0;
|
int interactive = 0;
|
||||||
char *oldpath = getenv("PATH");
|
|
||||||
struct libmnt_fs *fs;
|
struct libmnt_fs *fs;
|
||||||
|
const char *path = getenv("PATH");
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
|
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
|
||||||
setvbuf(stderr, NULL, _IONBF, BUFSIZ);
|
setvbuf(stderr, NULL, _IONBF, BUFSIZ);
|
||||||
|
@ -1573,16 +1574,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
load_fs_info();
|
load_fs_info();
|
||||||
|
|
||||||
/* Update our search path to include uncommon directories. */
|
fsck_path = xstrdup(path && *path ? path : FSCK_DEFAULT_PATH);
|
||||||
if (oldpath) {
|
|
||||||
fsck_path = xmalloc (strlen (fsck_prefix_path) + 1 +
|
|
||||||
strlen (oldpath) + 1);
|
|
||||||
strcpy (fsck_path, fsck_prefix_path);
|
|
||||||
strcat (fsck_path, ":");
|
|
||||||
strcat (fsck_path, oldpath);
|
|
||||||
} else {
|
|
||||||
fsck_path = xstrdup(fsck_prefix_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((num_devices == 1) || (serialize))
|
if ((num_devices == 1) || (serialize))
|
||||||
interactive = 1;
|
interactive = 1;
|
||||||
|
|
Loading…
Reference in New Issue