summaryrefslogtreecommitdiffstats
path: root/utils/statd/sm-notify.c
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-03-23 17:13:01 -0400
committerSteve Dickson <steved@redhat.com>2009-03-23 17:13:01 -0400
commit3724317e223d46908aac2405bbd73ea2de4f36e5 (patch)
tree4498459f0dd3f88349c5126792f3715200397eed /utils/statd/sm-notify.c
parentd62365079f711b25e73522b2af380abc2a7e2788 (diff)
downloadnfs-utils-3724317e223d46908aac2405bbd73ea2de4f36e5.tar.gz
nfs-utils-3724317e223d46908aac2405bbd73ea2de4f36e5.tar.xz
nfs-utils-3724317e223d46908aac2405bbd73ea2de4f36e5.zip
In recent Fedora builds, the '-D _FORTIFY_SOURCE=2' compile
flag has been set. This cause warnings to be generated when return values from reads/writes (and other calls) are not checked. The patch address those warnings. Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/statd/sm-notify.c')
-rw-r--r--utils/statd/sm-notify.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index d58e0be..f1fc619 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -782,7 +782,10 @@ static int record_pid(void)
fd = open("/var/run/sm-notify.pid", O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd < 0)
return 0;
- write(fd, pid, strlen(pid));
+ if (write(fd, pid, strlen(pid)) != strlen(pid)) {
+ nsm_log(LOG_WARNING, "Writing to pid file failed: errno %d(%s)",
+ errno, strerror(errno));
+ }
close(fd);
return 1;
}
@@ -818,12 +821,16 @@ static void drop_privs(void)
static void set_kernel_nsm_state(int state)
{
int fd;
+ const char *file = "/proc/sys/fs/nfs/nsm_local_state";
- fd = open("/proc/sys/fs/nfs/nsm_local_state",O_WRONLY);
+ fd = open(file ,O_WRONLY);
if (fd >= 0) {
char buf[20];
snprintf(buf, sizeof(buf), "%d", state);
- write(fd, buf, strlen(buf));
+ if (write(fd, buf, strlen(buf)) != strlen(buf)) {
+ nsm_log(LOG_WARNING, "Writing to '%s' failed: errno %d (%s)",
+ file, errno, strerror(errno));
+ }
close(fd);
}
}