Skip to content

Commit e35da92

Browse files
authored
Merge pull request #6889 from tautschnig/bugfixes/cond-getrandom
C library: getrandom requires glibc >= 2.25
2 parents 3376528 + df444b7 commit e35da92

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

regression/cbmc-library/getrandom-01/main.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#ifdef __linux__
2-
# include <sys/random.h>
3-
41
# include <assert.h>
52

3+
#if defined(__GLIBC__) && \
4+
(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))
5+
# include <sys/random.h>
6+
67
int main()
78
{
89
char zero_bytes[6] = {0};

src/ansi-c/library/random.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/* FUNCTION: getrandom */
22

3-
#ifdef __linux__
3+
#ifndef __CPROVER_ERRNO_H_INCLUDED
4+
#include <errno.h>
5+
#define __CPROVER_ERRNO_H_INCLUDED
6+
#endif
7+
8+
#if defined(__GLIBC__) && \
9+
(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))
410

511
# ifndef __CPROVER_SYS_RANDOM_H_INCLUDED
612
# include <sys/random.h>

0 commit comments

Comments
 (0)