Author: Craig Small Description: readproc.c some type conversion help return if unable to open /proc Index: b/proc/readproc.c =================================================================== --- a/proc/readproc.c 2009-11-24 20:53:03.000000000 +1100 +++ b/proc/readproc.c 2009-11-24 21:00:41.000000000 +1100 @@ -173,7 +173,7 @@ // examine a field name (hash and compare) base: if(unlikely(!*S)) break; - entry = table[63 & (asso[S[3]] + asso[S[2]] + asso[S[0]])]; + entry = table[63 & (asso[(int)S[3]] + asso[(int)S[2]] + asso[(int)S[0]])]; colon = strchr(S, ':'); if(unlikely(!colon)) break; if(unlikely(colon[1]!='\t')) break; @@ -942,6 +942,8 @@ else PT = openproc(flags); va_end(ap); + if (!PT) + return 0; do { /* read table: */ tab = xrealloc(tab, (n+1)*sizeof(proc_t*));/* realloc as we go, using */ tab[n] = readproc_direct(PT, NULL); /* final null to terminate */