Browse Source

fix broken sysconf when correct value is -1

this caused glib to try to allocate >2gb for getpwnam_r, and probably
numerous other problems.
Rich Felker 13 years ago
parent
commit
c613125966
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/conf/sysconf.c

+ 1 - 1
src/conf/sysconf.c

@@ -220,7 +220,7 @@ long sysconf(int name)
 	} else if (values[name] == OFLOW) {
 		if (name == _SC_ARG_MAX) return ARG_MAX;
 		if (name == _SC_SEM_VALUE_MAX) return SEM_VALUE_MAX;
-	} else if (values[name] < 0) {
+	} else if (values[name] < OFLOW) {
 		long lim[2];
 		__syscall(SYS_getrlimit, values[name]&16383, lim);
 		return lim[0] < 0 ? LONG_MAX : lim[0];