[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: memstat-0.9 hurd patch (PATH_MAX)

Hi Tanguy, great job!

2012/1/24 Tanguy LE CARROUR <tanguy.lecarrour@gmail.com>:
> I hope I've fixed all the bugs in my patch, but I have one last small
> question: Do I really need to check if BUFSIZ is defined?

Remaining quirks that I can see:
- You can drop -lm as well, since it's no longer be required.

- The body of the while loop should probably be indented.
- fgets(buf + last, buf_size - last, f); then you can realloc unconditionally

- random trick: you could substitute 'buff_size = 11' with 'buff_size
= sizeof "/proc//maps"' (includes the '\0'), then drop the comment [or
use Richard's version]
- "_ * sizeof(char)" : no need to bother, I think "sizeof (char)" is 1
by definition
- there is a remaining indentation problem with the first two lines in
the while() loop and in other spots, make sure you set your tabs to
print as 8 spaces.

 	    if (nread < 7) {
 		fprintf(stderr, "I don't recognize format of /proc/%d/maps.
(nread=%d)\n", pid, nread);
+		fclose(f);
+		closedir(d);

But aside from these minor issues and the one spotted by Richard, the
patch looks good to me.
Jérémie Koenig <jk@jk.fr.eu.org>

Reply to: