dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From eb6a90621a53424e4d0a5534eca303b432509433 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Mon, 8 Aug 2016 13:50:54 +0200
Subject: [PATCH 110/111] SECRETS: Use sss_atomic_read/write for better
 readability
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

sss_atomic_read_s and sss_atomic_write_s are macro-wrappers around
sss_atomic_io_s but it's easier to follow the code with the read/write
vairants used directly.

Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
---
 src/responder/secrets/local.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/responder/secrets/local.c b/src/responder/secrets/local.c
index 470aec0e195a54dd2af2b929ff1b7a304331a214..17469249b357cbdc5e50ddff6b563fdf2f377577 100644
--- a/src/responder/secrets/local.c
+++ b/src/responder/secrets/local.c
@@ -621,7 +621,7 @@ int generate_master_key(const char *filename, size_t size)
     fd = open(filename, O_CREAT|O_EXCL|O_WRONLY, 0600);
     if (fd == -1) return errno;
 
-    rsize = sss_atomic_io_s(fd, buf, size, false);
+    rsize = sss_atomic_write_s(fd, buf, size);
     close(fd);
     if (rsize != size) {
         ret = unlink(filename);
@@ -681,8 +681,8 @@ int local_secrets_provider_handle(struct sec_ctx *sctx,
     }
     if (ret) return EFAULT;
 
-    size = sss_atomic_io_s(mfd, lctx->master_key.data,
-                           lctx->master_key.length, true);
+    size = sss_atomic_read_s(mfd, lctx->master_key.data,
+                             lctx->master_key.length);
     close(mfd);
     if (size < 0 || size != lctx->master_key.length) return EIO;
 
-- 
2.4.11