summaryrefslogtreecommitdiffstats
path: root/utils/statd
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-12-11 12:34:34 -0500
committerSteve Dickson <steved@redhat.com>2009-12-12 10:29:32 -0500
commit686ae9e82b90881f5ea775602c7fd6c187980cad (patch)
treed16c99c335677fe59efe741e141808748789b28f /utils/statd
parent85747f37936c9b7ea599b3ad8a2c989989d45e68 (diff)
downloadnfs-utils-686ae9e82b90881f5ea775602c7fd6c187980cad.tar.gz
nfs-utils-686ae9e82b90881f5ea775602c7fd6c187980cad.tar.xz
nfs-utils-686ae9e82b90881f5ea775602c7fd6c187980cad.zip
statd: squelch compiler warning in sm-notify.c
Clean up: Get rid of a false positive compiler warning, seen with -Wextra. sm-notify.c: In function ¿record_pid¿: sm-notify.c:690: warning: comparison between signed and unsigned integer expressions Document some ignored return codes while we're here. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/statd')
-rw-r--r--utils/statd/sm-notify.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index 1d4403a..15d0a92 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -765,17 +765,21 @@ nsm_get_state(int update)
static int record_pid(void)
{
char pid[20];
+ ssize_t len;
int fd;
- snprintf(pid, 20, "%d\n", getpid());
+ (void)snprintf(pid, sizeof(pid), "%d\n", (int)getpid());
fd = open("/var/run/sm-notify.pid", O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd < 0)
return 0;
- if (write(fd, pid, strlen(pid)) != strlen(pid)) {
+
+ len = write(fd, pid, strlen(pid));
+ if ((len < 0) || ((size_t)len != strlen(pid))) {
xlog_warn("Writing to pid file failed: errno %d (%m)",
errno);
}
- close(fd);
+
+ (void)close(fd);
return 1;
}