Skip to content
Snippets Groups Projects
Commit ac1b26d7 authored by Roman Tsisyk's avatar Roman Tsisyk Committed by Buildslave
Browse files

Fix clang warnings

parent f32ac8cb
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ macro(libeio_build)
set(eio_compile_flags "${eio_compile_flags} -Wno-unused-result")
set(eio_compile_flags "${eio_compile_flags} -Wno-dangling-else")
set(eio_compile_flags "${eio_compile_flags} -Wno-unused-value")
set(eio_compile_flags "${eio_compile_flags} -DENABLE_BUNDLED_LIBEIO=1")
set(eio_compile_flags "${eio_compile_flags} -DEIO_STACKSIZE=0")
......
......@@ -21,7 +21,7 @@ find_path(const char *argv0)
return path;
char buf[PATH_MAX];
uint32_t size = PATH_MAX - 1;
size_t size = PATH_MAX - 1;
if (argv0[0] == '/')
snprintf(buf, size, "%s", argv0);
else {
......@@ -35,7 +35,8 @@ find_path(const char *argv0)
snprintf(buf, size, "%s", getexecname());
rc = 0;
#elif defined(__APPLE__)
rc = _NSGetExecutablePath(buf, &size);
uint32_t usize = size;
rc = _NSGetExecutablePath(buf, &usize);
#endif
if (rc == -1)
snprintf(buf, sizeof(buf) - 1, "%s", getenv("_"));
......
......@@ -51,9 +51,8 @@ random_init(void)
}
int flags = fcntl(rfd, F_GETFD);
if (flags < 0)
goto srand;
fcntl(rfd, F_SETFD, flags | FD_CLOEXEC);
if (flags != -1)
fcntl(rfd, F_SETFD, flags | FD_CLOEXEC);
read(rfd, &seed, sizeof(seed));
srand:
......@@ -72,10 +71,11 @@ random_free(void)
void
random_bytes(char *buf, size_t size)
{
size_t generated = 0;
if (rfd == -1)
goto rand;
size_t generated = 0;
int attempt = 0;
while (generated < size) {
ssize_t n = read(rfd, buf + generated, size - generated);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment