X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fstatd%2Fsm-notify.c;h=f1fc619a9b4c3ab9398e27d073af588d81bdf31a;hb=caafae66d6fcdb6210a87261e6ea07252700a278;hp=d58e0be421859ed6c59880e917d53a53a874b877;hpb=f846abde5faa4742b4823fa981080b1f5dac66b1;p=nfs-utils.git 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); } }