Merge branch 'matthiasc/for-main' into 'main'

printing: Avoid getrandom

See merge request GNOME/gtk!5530
This commit is contained in:
Matthias Clasen 2023-02-17 22:39:04 +00:00
commit e51fa8b65b

View File

@ -19,7 +19,6 @@
#include <glib.h>
#include <sys/random.h>
#include "gtkprintbackendutils.h"
@ -115,11 +114,9 @@ random_string (int n)
"0123456789";
char *str = g_new0 (char, n + 1);
getrandom (str, n, 0);
for (int i = 0; i < n; i++)
{
int rand = str[i] + 128;
int idx = rand % ((int) sizeof charset);
int idx = g_random_int_range (0, strlen (charset));
str[i] = charset[idx];
}
str[n] = '\0';