We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 055c092 commit d0f3bfdCopy full SHA for d0f3bfd
src/os/posix/dev-file.c
@@ -434,13 +434,15 @@ static int Get_File_Info(REBREQ *file)
434
}
435
436
// Resolves real size of virtual files (like /proc/cpuinfo)
437
+// NOTE: always use read/part with files like /dev/urandom
438
static size_t get_virtual_file_size(const char *filepath) {
439
#define BUFFER_SIZE 4096
440
+ #define READ_LIMIT 0x80000000 // Rebol has limit 2GB for series
441
char buffer[BUFFER_SIZE];
442
size_t size = 0;
443
int file = open(filepath, O_RDONLY, S_IREAD);
444
if (file) {
- while (1) {
445
+ while (size < READ_LIMIT) {
446
size_t bytesRead = read(file, buffer, BUFFER_SIZE);
447
if (bytesRead == 0) break;
448
size += bytesRead;
0 commit comments