Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 872821
Collapse All | Expand All

(-)a/psinfo.c (-4 / +4 lines)
Lines 172-185 int parse_proc_wchan(FILE * f, struct process_info *p) Link Here
172
int parse_proc_arrayfile(char *name, char ***s)
172
int parse_proc_arrayfile(char *name, char ***s)
173
{
173
{
174
	FILE *f;
174
	FILE *f;
175
	int res = 1;
175
	int ret, res = 1;
176
176
177
	if ((f = fopen(name, "r")) != NULL) {
177
	if ((f = fopen(name, "r")) != NULL) {
178
		char *buf;
178
		char *buf;
179
		int len = 0, bufsize = 1024, count = 0;
179
		int len = 0, bufsize = 1024, count = 0;
180
180
181
		buf = malloc(bufsize);
181
		buf = malloc(bufsize);
182
		while ((buf[len++] = fgetc(f)) != EOF) {
182
		while ((ret = fgetc(f)) != EOF) {
183
			buf[len++] = ret & 0xFF;
183
			if (buf[len - 1] == 0) {
184
			if (buf[len - 1] == 0) {
184
				*s = realloc(*s, (count + 2) * sizeof(char *));
185
				*s = realloc(*s, (count + 2) * sizeof(char *));
185
				(*s)[count] = malloc(len);
186
				(*s)[count] = malloc(len);
Lines 673-680 void print_help() Link Here
673
int main(int argc, char **argv)
674
int main(int argc, char **argv)
674
{
675
{
675
	struct process_info *p;
676
	struct process_info *p;
676
	int pid, output_general = 0, output_cpu = 0, output_io = 0, output_memory = 0, output_privilege = 0, output_signal = 0, result = 0;
677
	int c, pid, output_general = 0, output_cpu = 0, output_io = 0, output_memory = 0, output_privilege = 0, output_signal = 0, result = 0;
677
	char c;
678
678
679
	opterr = 0;
679
	opterr = 0;
680
	if (argc <= 1) {
680
	if (argc <= 1) {

Return to bug 872821