On Mon, May 05, 2014 at 05:05:29PM +0200, Pino Toscano wrote:
+ snprintf (envvar, sizeof (envvar) - 1, "%s_%s",
ourenvvar, fs->fs_name);
Is this right?
I'm tempted to say it should be `sizeof envvar'. However my knowledge
of C is not clear enough to say whether that would evaluate to the
size of the array or the size of a pointer (8 bytes).
So perhaps it's safer to use something like:
const size_t len = /* computed size */;
const char envvar[len];
/* ... */
snprintf (envvar, len, ...);
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top