Skip to content

Commit 411fd43

Browse files
author
Sriya Pratipati
committed
updated cmake and removed double negative
1 parent 5420382 commit 411fd43

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

libc/src/__support/OSUtil/linux/CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ add_object_library(
1212
HDRS
1313
io.h
1414
syscall.h
15-
getrandom.h
1615
DEPENDS
1716
.${LIBC_TARGET_ARCHITECTURE}.linux_${LIBC_TARGET_ARCHITECTURE}_util
1817
libc.src.__support.common
@@ -25,6 +24,19 @@ add_object_library(
2524
libc.include.sys_syscall
2625
)
2726

27+
add_header_library(
28+
getrandom
29+
HDRS
30+
getrandom.h
31+
DEPENDS
32+
libc.src.__support.OSUtil.linux.syscall
33+
libc.src.__support.common
34+
libc.src.__support.error_or
35+
libc.src.__support.macros.config.h
36+
libc.hdr.types.ssize_t
37+
libc.include.sys_syscall
38+
)
39+
2840
add_header_library(
2941
vdso_sym
3042
HDRS

libc/src/sys/random/linux/getrandom.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
1313
#include "src/__support/common.h"
1414
#include "src/__support/error_or.h"
15-
1615
#include "src/__support/libc_errno.h"
1716
#include "src/__support/macros/config.h"
1817
#include <sys/syscall.h> // For syscall numbers.
@@ -24,7 +23,7 @@ LLVM_LIBC_FUNCTION(ssize_t, getrandom,
2423
auto rand = internal::getrandom(buf, buflen, flags);
2524
if (rand.has_value())
2625
return rand.value();
27-
libc_errno = static_cast<int>(-(rand.error()));
26+
libc_errno = static_cast<int>(rand.error());
2827
return -1;
2928
}
3029

0 commit comments

Comments
 (0)