diff options
author | pjd <pjd@FreeBSD.org> | 2004-12-27 17:20:06 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-12-27 17:20:06 +0000 |
commit | b19cea505cff9159f9680eb46daaf51d14fb3809 (patch) | |
tree | 55fe765c8368400583f00b5c70626fe1601950c0 /sbin/mdconfig | |
parent | c06a300010399909b6dab3e40803805da5975383 (diff) | |
download | FreeBSD-src-b19cea505cff9159f9680eb46daaf51d14fb3809.zip FreeBSD-src-b19cea505cff9159f9680eb46daaf51d14fb3809.tar.gz |
Rewrite piece of code which I committed some time ago that allows to
show file name for 'mdconfig -l -u <x>' command.
This allows to preserve API/ABI compatibility with version 0 (that's why
I changed version number back to 0) and will allow to merge this change
to RELENG_5.
MFC after: 5 days
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r-- | sbin/mdconfig/mdconfig.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index d4cca40..0e6d818 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -60,6 +60,10 @@ main(int argc, char **argv) int cmdline = 0; bzero(&mdio, sizeof(mdio)); + mdio.md_file = malloc(PATH_MAX); + if (mdio.md_file == NULL) + err(1, "could not allocate memory"); + bzero(mdio.md_file, PATH_MAX); for (;;) { ch = getopt(argc, argv, "ab:df:lno:s:S:t:u:x:y:"); if (ch == -1) @@ -223,7 +227,7 @@ main(int argc, char **argv) if (mdio.md_mediasize == 0) errx(1, "must specify -s for -t malloc or -t swap"); if (cmdline == 2 && mdio.md_type == MD_VNODE) - if (mdio.md_file == NULL) + if (mdio.md_file[0] == '\0') errx(1, "must specify -f for -t vnode"); if (action == LIST) { if (mdio.md_options & MD_AUTOUNIT) |