On Wed, May 04, 2011 at 10:20:22AM -0300, Davidlohr Bueso wrote: > On Wed, 2011-05-04 at 10:02 +0200, Voelker, Bernhard wrote: > > Davidlohr Bueso wrote: > > +struct proc_tasks *proc_open_tasks(pid_t pid) > > +{ > > + struct proc_tasks *tasks; > > + char path[PATH_MAX]; > > + > > + sprintf(path, "/proc/%d/task/", pid); > > + > > + tasks = malloc(sizeof(struct proc_tasks)); > > + if (!tasks) > > + return NULL; > > + > > + tasks->dir = opendir(path); > > + if (!tasks->dir) > > + return NULL; > > + > > + return tasks; > > +} > > > > shouldn't tasks be freed if opendir fails? > > Yes. > > > +int main(int argc, char *argv[]) > > +{ > > + int i = 0; > > > > warning: unused variable 'i' > > And yes. > > Karel, would you rather have me resend a patch with these fixes or do it > yourself before applying (if you do such a thing)? Fixed & Applied. I have also a little changed proc_next_tid() to return 1 at the end of the directory, so -1 means error only. Thanks! Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html