From db7f2f6e89c7fcff8bb552129564018b3d6ac4b8 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Mon, 13 Oct 2014 07:57:44 -0400 Subject: src/shared/util.c: cosmetic changes to more easily follow upstream Signed-off-by: Anthony G. Basile --- src/shared/util.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/shared/util.c b/src/shared/util.c index 61513bade5..9672b7fcc0 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -208,6 +208,7 @@ int parse_uid(const char *s, uid_t* ret_uid) { *ret_uid = uid; return 0; } + int safe_atou(const char *s, unsigned *ret_u) { char *x = NULL; unsigned long l; @@ -338,7 +339,6 @@ const char* split(const char **state, size_t *l, const char *separator, bool quo return current; } - char *truncate_nl(char *s) { assert(s); @@ -427,23 +427,6 @@ int rmdir_parents(const char *path, const char *stop) { return 0; } -int dev_urandom(void *p, size_t n) { - _cleanup_close_ int fd; - ssize_t k; - - fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY); - if (fd < 0) - return errno == ENOENT ? -ENOSYS : -errno; - - k = loop_read(fd, p, n, true); - if (k < 0) - return (int) k; - if ((size_t) k != n) - return -EIO; - - return 0; -} - char hexchar(int x) { static const char table[16] = "0123456789abcdef"; @@ -741,6 +724,23 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) { return n; } +int dev_urandom(void *p, size_t n) { + _cleanup_close_ int fd; + ssize_t k; + + fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY); + if (fd < 0) + return errno == ENOENT ? -ENOSYS : -errno; + + k = loop_read(fd, p, n, true); + if (k < 0) + return (int) k; + if ((size_t) k != n) + return -EIO; + + return 0; +} + void random_bytes(void *p, size_t n) { static bool srand_called = false; uint8_t *q; -- cgit v1.2.3-54-g00ecf