aboutsummaryrefslogtreecommitdiff
path: root/lib/daemon.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-02-01 11:24:51 -0800
committerBen Pfaff <blp@nicira.com>2011-02-03 14:56:33 -0800
commite7668254f2f8f7208905c858ffbc84a65bb13815 (patch)
treef61d4f3585c6fbbfa7f10851ee5052445d910321 /lib/daemon.c
parent535d6987a7af3bef33bf2db21b52bb81e3ea64ee (diff)
daemon: Suppress valgrind warnings from read_pidfile().
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.
Diffstat (limited to 'lib/daemon.c')
-rw-r--r--lib/daemon.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/daemon.c b/lib/daemon.c
index c0f16829..9db6c1f8 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -1,5 +1,5 @@
/*
- * 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.
@@ -536,6 +536,7 @@ read_pidfile(const char *pidfile)
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));