summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkfs.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:33 +0100
committerKarel Zak2006-12-07 00:26:33 +0100
commitbf3baa99075f6df0bea4cd857aa340694339dd9d (patch)
tree9dba6996348ddc430c30fb9fa0737963c25f283b /disk-utils/mkfs.c
parentImported from util-linux-2.12o tarball. (diff)
downloadkernel-qcow2-util-linux-bf3baa99075f6df0bea4cd857aa340694339dd9d.tar.gz
kernel-qcow2-util-linux-bf3baa99075f6df0bea4cd857aa340694339dd9d.tar.xz
kernel-qcow2-util-linux-bf3baa99075f6df0bea4cd857aa340694339dd9d.zip
Imported from util-linux-2.12p tarball.
Diffstat (limited to 'disk-utils/mkfs.c')
-rw-r--r--disk-utils/mkfs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c
index e04877b86..38bacc034 100644
--- a/disk-utils/mkfs.c
+++ b/disk-utils/mkfs.c
@@ -21,7 +21,6 @@
#include <unistd.h>
#include <string.h>
#include <getopt.h>
-#include <limits.h>
#include "nls.h"
#define VERSION UTIL_LINUX_VERSION
@@ -36,7 +35,7 @@
int main(int argc, char *argv[])
{
- char progname[NAME_MAX];
+ char *progname; /* name of executable to be called */
char *fstype = NULL;
int i, more = 0, verbose = 0;
char *oldpath, *newpath;
@@ -85,6 +84,7 @@ int main(int argc, char *argv[])
oldpath = getenv("PATH");
if (!oldpath)
oldpath = "/bin";
+
newpath = (char *) malloc(strlen(oldpath) + sizeof(SEARCH_PATH) + 3);
if (!newpath) {
fprintf(stderr, _("%s: Out of memory!\n"), "mkfs");
@@ -92,7 +92,13 @@ int main(int argc, char *argv[])
}
sprintf(newpath, "%s:%s\n", SEARCH_PATH, oldpath);
putenv(newpath);
- snprintf(progname, sizeof(progname), PROGNAME, fstype);
+
+ progname = (char *) malloc(sizeof(PROGNAME) + strlen(fstype) + 1);
+ if (!newpath) {
+ fprintf(stderr, _("%s: Out of memory!\n"), "mkfs");
+ exit(1);
+ }
+ sprintf(progname, PROGNAME, fstype);
argv[--optind] = progname;
if (verbose) {