Paul
I think there's a bug introduced by some of the edits made before
you committed my pid_output.c changes. Specifically,
59 struct flock lock = { .l_type = F_WRLCK,
60 .l_whence = SEEK_END };
doesn't stick because it's zero-ed out at line 73:
73 memset (&lock, 0, sizeof(lock));
74
75 if (fcntl(fd, F_SETLK, &lock) < 0)
76 {
77 zlog_err("Could not lock pid_file %s, exit", path);
78 exit (-1);
79 }
Either the memset should be removed, or the initialization
of l_type and l_whence should be done afer line 73. I'm attaching
a patch for the latter choice
This bug was the cause of Markus' problem (thanks for confirming, Markus!).
--Sowmini
--- pid_output.c.orig Thu Oct 30 14:58:26 2003
+++ pid_output.c Thu Oct 30 14:36:01 2003
@@ -56,8 +56,7 @@
int fd;
pid_t pid;
char buf[16];
- struct flock lock = { .l_type = F_WRLCK,
- .l_whence = SEEK_END };
+ struct flock lock;
pid = getpid ();
@@ -72,6 +71,9 @@
{
memset (&lock, 0, sizeof(lock));
+ lock.l_type = F_WRLCK;
+ lock.l_whence = SEEK_END;
+
if (fcntl(fd, F_SETLK, &lock) < 0)
{
zlog_err("Could not lock pid_file %s, exit", path);
I think there's a bug introduced by some of the edits made before
you committed my pid_output.c changes. Specifically,
59 struct flock lock = { .l_type = F_WRLCK,
60 .l_whence = SEEK_END };
doesn't stick because it's zero-ed out at line 73:
73 memset (&lock, 0, sizeof(lock));
74
75 if (fcntl(fd, F_SETLK, &lock) < 0)
76 {
77 zlog_err("Could not lock pid_file %s, exit", path);
78 exit (-1);
79 }
Either the memset should be removed, or the initialization
of l_type and l_whence should be done afer line 73. I'm attaching
a patch for the latter choice
This bug was the cause of Markus' problem (thanks for confirming, Markus!).
--Sowmini
--- pid_output.c.orig Thu Oct 30 14:58:26 2003
+++ pid_output.c Thu Oct 30 14:36:01 2003
@@ -56,8 +56,7 @@
int fd;
pid_t pid;
char buf[16];
- struct flock lock = { .l_type = F_WRLCK,
- .l_whence = SEEK_END };
+ struct flock lock;
pid = getpid ();
@@ -72,6 +71,9 @@
{
memset (&lock, 0, sizeof(lock));
+ lock.l_type = F_WRLCK;
+ lock.l_whence = SEEK_END;
+
if (fcntl(fd, F_SETLK, &lock) < 0)
{
zlog_err("Could not lock pid_file %s, exit", path);