Davidlohr Bueso wrote: > +static char *get_cmdname(pid_t pid) > +{ > + FILE *fp; > + char path[PATH_MAX]; > + > + sprintf(path, "/proc/%d/comm", pid); > + if (!(fp = fopen(path, "r"))) > + return NULL; > + > + /* just need the first line */ > + if (!fgets(path, sizeof(path), fp)) > + goto out; > +out: this looks strange to me: if fgets fails, then we want to ... > + fclose(fp); ... but certainly not this: > + path[strlen(path) - 1] = '\0'; > + return xstrdup(path); > +} Have a nice day, Berny -- 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