diff options
author | Mike Frysinger | 2015-04-12 11:06:51 +0200 |
---|---|---|
committer | Karel Zak | 2015-04-27 10:28:44 +0200 |
commit | 07b5156790f329835d7351aa4e803f3d623cde5d (patch) | |
tree | 89a2bb7cc099fed3028e12f169d6a2dc9cea4987 /disk-utils/mkfs.c | |
parent | hwclock: flush stdout in hwclock -c (diff) | |
download | kernel-qcow2-util-linux-07b5156790f329835d7351aa4e803f3d623cde5d.tar.gz kernel-qcow2-util-linux-07b5156790f329835d7351aa4e803f3d623cde5d.tar.xz kernel-qcow2-util-linux-07b5156790f329835d7351aa4e803f3d623cde5d.zip |
mkfs: drop hardcoded search path
Rather than maintain a hardcoded search path for looking up tools and
override the user's PATH env setting, respect whatever the user has.
This matches the convention of just about every other tool out there.
It might break on systems that don't have /sbin in their PATH and they
try to run /sbin/mkfs directly, but so be it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'disk-utils/mkfs.c')
-rw-r--r-- | disk-utils/mkfs.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c index 08c4ef0b0..cf1a312d9 100644 --- a/disk-utils/mkfs.c +++ b/disk-utils/mkfs.c @@ -38,10 +38,6 @@ #define DEFAULT_FSTYPE "ext2" #endif -#define SEARCH_PATH "PATH=" FS_SEARCH_PATH -#define PROGNAME "mkfs.%s" - - static void __attribute__ ((__noreturn__)) usage(FILE * out) { fputs(USAGE_HEADER, out); @@ -78,7 +74,6 @@ int main(int argc, char **argv) char *progname; /* name of executable to be called */ char *fstype = NULL; int i, more = 0, verbose = 0; - char *oldpath, *newpath; enum { VERSION_OPTION = CHAR_MAX + 1 }; @@ -126,17 +121,7 @@ int main(int argc, char **argv) if (fstype == NULL) fstype = DEFAULT_FSTYPE; - /* Set PATH and program name */ - oldpath = getenv("PATH"); - if (!oldpath) - oldpath = "/bin"; - - newpath = xmalloc(strlen(oldpath) + sizeof(SEARCH_PATH) + 3); - sprintf(newpath, "%s:%s\n", SEARCH_PATH, oldpath); - putenv(newpath); - - progname = xmalloc(sizeof(PROGNAME) + strlen(fstype) + 1); - sprintf(progname, PROGNAME, fstype); + xasprintf(&progname, "mkfs.%s", fstype); argv[--optind] = progname; if (verbose) { |