summaryrefslogtreecommitdiff
path: root/src/responder
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-04-02 17:26:05 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-04-20 10:55:14 -0400
commit9d7d4458d94d0aac0a7edf999368eb18f89cb76a (patch)
treeb443c2ed560bc5f61cae78e94ceeb795fa1f83b4 /src/responder
parent9959c512ac3ba36f7a0db7614f0357ce0bae748f (diff)
downloadsssd-9d7d4458d94d0aac0a7edf999368eb18f89cb76a.tar.gz
sssd-9d7d4458d94d0aac0a7edf999368eb18f89cb76a.tar.bz2
sssd-9d7d4458d94d0aac0a7edf999368eb18f89cb76a.zip
Convert read and write operations to sss_atomic_read
https://fedorahosted.org/sssd/ticket/1209
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/nss/nsssrv_mmap_cache.c20
-rw-r--r--src/responder/ssh/sshsrv_cmd.c2
2 files changed, 11 insertions, 11 deletions
diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
index 7a7a498b..e60d0619 100644
--- a/src/responder/nss/nsssrv_mmap_cache.c
+++ b/src/responder/nss/nsssrv_mmap_cache.c
@@ -512,16 +512,16 @@ static errno_t sss_mc_set_recycled(int fd)
/* What do we do now ? */
return errno;
}
- pos = 0;
- while (pos < sizeof(h.status)) {
- ret = write(fd, ((uint8_t *)&w) + pos, sizeof(h.status) - pos);
- if (ret == -1) {
- if (errno != EINTR) {
- return errno;
- }
- continue;
- }
- pos += ret;
+
+ errno = 0;
+ ret = sss_atomic_write_s(fd, (uint8_t *)&w, sizeof(h.status));
+ if (ret == -1) {
+ return errno;
+ }
+
+ if (ret != sizeof(h.status)) {
+ /* Write error */
+ return EIO;
}
return EOK;
diff --git a/src/responder/ssh/sshsrv_cmd.c b/src/responder/ssh/sshsrv_cmd.c
index 4882bacf..14913707 100644
--- a/src/responder/ssh/sshsrv_cmd.c
+++ b/src/responder/ssh/sshsrv_cmd.c
@@ -516,7 +516,7 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx)
goto done;
}
- wret = sss_atomic_write(fd, line, strlen(line));
+ wret = sss_atomic_write_s(fd, line, strlen(line));
if (wret == -1) {
ret = errno;
goto done;