summaryrefslogtreecommitdiff
path: root/usr.bin/getconf
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2003-07-21 20:55:37 +0000
committerMark Murray <markm@FreeBSD.org>2003-07-21 20:55:37 +0000
commit0cd41dca9a25a3249863ae2d9fef325f8bf7ba01 (patch)
treeea6ad8ed23017ab477d64016a2b859417bd79904 /usr.bin/getconf
parent7d8b5aa2c13bef6a5b660b7a2ab3790f5aad54e8 (diff)
downloadsrc-test2-0cd41dca9a25a3249863ae2d9fef325f8bf7ba01.tar.gz
src-test2-0cd41dca9a25a3249863ae2d9fef325f8bf7ba01.zip
Notes
Diffstat (limited to 'usr.bin/getconf')
-rw-r--r--usr.bin/getconf/getconf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c
index 8bfeb93c4713..14345c624110 100644
--- a/usr.bin/getconf/getconf.c
+++ b/usr.bin/getconf/getconf.c
@@ -148,9 +148,14 @@ do_confstr(const char *name, int key)
if (len == 0) {
printf("undefined\n");
} else {
- buf = alloca(len);
- confstr(key, buf, len);
- printf("%s\n", buf);
+ buf = malloc(len);
+ if (buf != NULL) {
+ confstr(key, buf, len);
+ printf("%s\n", buf);
+ free(buf);
+ }
+ else
+ err(EX_OSERR, "malloc: confstr");
}
}