X-Git-Url: https://git.saurik.com/apple/system_cmds.git/blobdiff_plain/709a58224ea43109dc10bfd6a67de1e432174197..34d340d711a2b033f5da480ed7b5eb147679a588:/getconf.tproj/getconf.c?ds=inline diff --git a/getconf.tproj/getconf.c b/getconf.tproj/getconf.c index 8b636dd..9cb0b7d 100644 --- a/getconf.tproj/getconf.c +++ b/getconf.tproj/getconf.c @@ -96,12 +96,6 @@ main(int argc, char **argv) } if (argv[optind + 1] == NULL) { /* confstr or sysconf */ -#ifdef APPLE_GETCONF_SPEC - if ((valid = find_progenv(name, &alt_path)) != 0) { - printf(valid > 0 ? "defined\n" : "undefined\n"); - return 0; - } -#endif /* APPLE_GETCONF_SPEC */ if ((valid = find_limit(name, &limitval)) != 0) { if (valid > 0) printf("%" PRIdMAX "\n", limitval); @@ -146,13 +140,15 @@ do_confstr(const char *name, int key) { size_t len; + errno = 0; len = confstr(key, 0, 0); - if (len == (size_t)-1) - err(EX_OSERR, "confstr: %s", name); - - if (len == 0) - printf("undefined\n"); - else { + if (len == 0) { + if (errno != 0) { + err(EX_OSERR, "confstr: %s", name); + } else { + printf("undefined\n"); + } + } else { char buf[len + 1]; confstr(key, buf, len);