Skip to content

Commit

Permalink
Merge pull request #460 from Jafaral/fix-getrandom
Browse files Browse the repository at this point in the history
runtime: avoid name collision with getrandom from libc
  • Loading branch information
Jafaral authored May 14, 2024
2 parents 1bbaa46 + 27b385c commit f38d731
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/h/rproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ int fldlookup (struct b_record *rec, const char * const fld);
void fpetrap (void);

int getenv_r (const char *name, char *buf, size_t len);
word getrandom (void);
int getvar (char *s,dptr vp);

int getkeyword (char *s, dptr vp);
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/init.r
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static FILE * readhdr (char *name, struct header *hdr);
/*
* Prototypes.
*/

static word unicon_getrandom(void);
static void env_err (char *msg, char *name, char *val);
FILE *pathOpen (char *fname, char *mode);

Expand Down Expand Up @@ -627,7 +627,7 @@ void init_threadstate( struct threadstate *ts)
StrLoc(ts->ksub) = "";
ts->Kywd_ran = zerodesc;
IntVal(ts->Kywd_ran) = getrandom();
IntVal(ts->Kywd_ran) = unicon_getrandom();
ts->K_errornumber = 0;
ts->K_level = 0;
ts->T_errornumber = 0;
Expand Down Expand Up @@ -1655,7 +1655,7 @@ int err()
return strcmp(a->pstrep, b->pstrep);
}

word getrandom()
static word unicon_getrandom(void)
{
#ifndef NoRandomize
/*
Expand Down Expand Up @@ -1787,7 +1787,7 @@ void datainit()
k_output.status = Fs_Write;

IntVal(kywd_pos) = 1;
IntVal(kywd_ran) = getrandom();
IntVal(kywd_ran) = unicon_getrandom();

StrLen(kywd_prog) = strlen(prog_name);
StrLoc(kywd_prog) = prog_name;
Expand Down

0 comments on commit f38d731

Please sign in to comment.