diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2014-10-13 07:57:44 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-10-13 07:57:49 -0400 |
commit | db7f2f6e89c7fcff8bb552129564018b3d6ac4b8 (patch) | |
tree | 72a379cec688f5956f99d1f93257e796fbe4d6b5 | |
parent | 914f56525b8ac0552813aaf3031c8d5092542237 (diff) |
src/shared/util.c: cosmetic changes to more easily follow upstream
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | src/shared/util.c | 36 |
1 files 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; |