os: make GenerateRandomData() independent of XCSECURITY

The function itself does not depend on the macro. Move it outside
of the ifdef guard and remove the identical copy in XWIN.

This is step 1 towards removing the duplication in winauth.c and moving
the OS specifics to os/

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
This commit is contained in:
Emil Velikov 2017-08-22 11:48:26 +01:00 committed by Adam Jackson
parent 8aee1f40ea
commit 292ee71516
2 changed files with 2 additions and 12 deletions

View File

@ -68,16 +68,6 @@ static xcb_auth_info_t auth_info;
*/
#ifndef XCSECURITY
void
GenerateRandomData(int len, char *buf)
{
int fd;
fd = open("/dev/urandom", O_RDONLY);
read(fd, buf, len);
close(fd);
}
static char cookie[16]; /* 128 bits */
XID

View File

@ -302,6 +302,8 @@ GenerateAuthorization(unsigned name_length,
return -1;
}
#endif /* XCSECURITY */
void
GenerateRandomData(int len, char *buf)
{
@ -315,5 +317,3 @@ GenerateRandomData(int len, char *buf)
close(fd);
#endif
}
#endif /* XCSECURITY */