On Tue, 27.07.10 10:48, Dhaval Giani ([email protected]) wrote:
> + procs = fopen(cgroup_path, "r");
You want to use "re" here.
> + while (!feof(procs) && n < tot_procs) {
> + pid_t pid;
> + err = fscanf(procs, "%u", &pid);
> + if (err == EOF)
> + break;
You should compare err with 1.
> + tmp_list = realloc(tmp_list, sizeof(pid_t) *
> tot_procs);
You need to place the return value in a seperate variable first, because
otherwise in case of OOM you miss to free the old tmp_list. (on oom
realloc() returns NULL but leaves the old memory allocated -- see the
man page).
Lennart
--
Lennart Poettering - Red Hat, Inc.
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel