summaryrefslogtreecommitdiffstats
path: root/utils/statd
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-03-29 13:07:58 +1000
committerNeil Brown <neilb@suse.de>2007-03-29 13:07:58 +1000
commit4d53ca0ba7a855df0dea0808d395ee74c482dfb1 (patch)
tree9f649e17dac055bf2c9ac4cf100055d9818dd932 /utils/statd
parent7b01c4762ae242d2114cc6a59994f678b7d253fc (diff)
downloadnfs-utils-4d53ca0ba7a855df0dea0808d395ee74c482dfb1.tar.gz
nfs-utils-4d53ca0ba7a855df0dea0808d395ee74c482dfb1.tar.xz
nfs-utils-4d53ca0ba7a855df0dea0808d395ee74c482dfb1.zip
sm-notify - fix bugs related to run-only-once.
Make sure that sm-notify really runs only once per reboot. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/statd')
-rw-r--r--utils/statd/sm-notify.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index cdadcd7..0eb0b09 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -149,7 +149,7 @@ usage: fprintf(stderr,
}
if (strcmp(_SM_BASE_PATH, BASEDIR) == 0) {
- if (record_pid() == 0 && force == 0 && opt_update_state == 0)
+ if (record_pid() == 0 && force == 0 && opt_update_state == 1)
/* already run, don't try again */
exit(0);
}
@@ -713,7 +713,7 @@ static int record_pid()
snprintf(pid, 20, "%d\n", getpid());
fd = open("/var/run/sm-notify.pid", O_CREAT|O_EXCL|O_WRONLY, 0600);
- if (!fd)
+ if (fd < 0)
return 0;
write(fd, pid, strlen(pid));
close(fd);