|
|
b2d430 |
From eb6a90621a53424e4d0a5534eca303b432509433 Mon Sep 17 00:00:00 2001
|
|
|
b2d430 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
b2d430 |
Date: Mon, 8 Aug 2016 13:50:54 +0200
|
|
|
b2d430 |
Subject: [PATCH 110/111] SECRETS: Use sss_atomic_read/write for better
|
|
|
b2d430 |
readability
|
|
|
b2d430 |
MIME-Version: 1.0
|
|
|
b2d430 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b2d430 |
Content-Transfer-Encoding: 8bit
|
|
|
b2d430 |
|
|
|
b2d430 |
sss_atomic_read_s and sss_atomic_write_s are macro-wrappers around
|
|
|
b2d430 |
sss_atomic_io_s but it's easier to follow the code with the read/write
|
|
|
b2d430 |
vairants used directly.
|
|
|
b2d430 |
|
|
|
b2d430 |
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
|
|
|
b2d430 |
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
|
|
|
b2d430 |
---
|
|
|
b2d430 |
src/responder/secrets/local.c | 6 +++---
|
|
|
b2d430 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
b2d430 |
|
|
|
b2d430 |
diff --git a/src/responder/secrets/local.c b/src/responder/secrets/local.c
|
|
|
b2d430 |
index 470aec0e195a54dd2af2b929ff1b7a304331a214..17469249b357cbdc5e50ddff6b563fdf2f377577 100644
|
|
|
b2d430 |
--- a/src/responder/secrets/local.c
|
|
|
b2d430 |
+++ b/src/responder/secrets/local.c
|
|
|
b2d430 |
@@ -621,7 +621,7 @@ int generate_master_key(const char *filename, size_t size)
|
|
|
b2d430 |
fd = open(filename, O_CREAT|O_EXCL|O_WRONLY, 0600);
|
|
|
b2d430 |
if (fd == -1) return errno;
|
|
|
b2d430 |
|
|
|
b2d430 |
- rsize = sss_atomic_io_s(fd, buf, size, false);
|
|
|
b2d430 |
+ rsize = sss_atomic_write_s(fd, buf, size);
|
|
|
b2d430 |
close(fd);
|
|
|
b2d430 |
if (rsize != size) {
|
|
|
b2d430 |
ret = unlink(filename);
|
|
|
b2d430 |
@@ -681,8 +681,8 @@ int local_secrets_provider_handle(struct sec_ctx *sctx,
|
|
|
b2d430 |
}
|
|
|
b2d430 |
if (ret) return EFAULT;
|
|
|
b2d430 |
|
|
|
b2d430 |
- size = sss_atomic_io_s(mfd, lctx->master_key.data,
|
|
|
b2d430 |
- lctx->master_key.length, true);
|
|
|
b2d430 |
+ size = sss_atomic_read_s(mfd, lctx->master_key.data,
|
|
|
b2d430 |
+ lctx->master_key.length);
|
|
|
b2d430 |
close(mfd);
|
|
|
b2d430 |
if (size < 0 || size != lctx->master_key.length) return EIO;
|
|
|
b2d430 |
|
|
|
b2d430 |
--
|
|
|
b2d430 |
2.4.11
|
|
|
b2d430 |
|