The version of valgrind I have in my test VMs doesn't know what F_GETLK
does, so it complains that l_pid is uninitialized even though fcntl sets
it. Initializing it ourselves before calling the function avoids a series
of false-positive warnings about use of uninitialized data.
/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
lck.l_whence = SEEK_SET;
lck.l_start = 0;
lck.l_len = 0;
+ lck.l_pid = 0;
if (fcntl(fileno(file), F_GETLK, &lck)) {
error = errno;
VLOG_WARN("%s: fcntl: %s", pidfile, strerror(error));