summaryrefslogtreecommitdiff
path: root/mail/clamav/patches/patch-ac
diff options
context:
space:
mode:
Diffstat (limited to 'mail/clamav/patches/patch-ac')
-rw-r--r--mail/clamav/patches/patch-ac35
1 files changed, 35 insertions, 0 deletions
diff --git a/mail/clamav/patches/patch-ac b/mail/clamav/patches/patch-ac
new file mode 100644
index 00000000000..810ab8a6dfb
--- /dev/null
+++ b/mail/clamav/patches/patch-ac
@@ -0,0 +1,35 @@
+$NetBSD: patch-ac,v 1.3 2004/02/29 03:45:37 toshii Exp $
+
+--- libclamav/others.c.orig Wed Feb 11 08:03:01 2004
++++ libclamav/others.c
+@@ -261,13 +261,13 @@
+
+ unsigned int cl_rndnum(unsigned int max)
+ {
+- FILE *fd;
++ int fd;
+ unsigned int generated;
+ char *byte;
+ int size;
+
+
+- if((fd = fopen("/dev/urandom", "rb")) == NULL) {
++ if((fd = open("/dev/urandom", O_RDONLY)) < 0) {
+ cli_errmsg("!Can't open /dev/urandom.\n");
+ return -1;
+ }
+@@ -276,12 +276,12 @@
+ size = sizeof(generated);
+ do {
+ int bread;
+- bread = fread(byte, 1, size, fd);
++ bread = read(fd, byte, size);
+ size -= bread;
+ byte += bread;
+ } while(size > 0);
+
+- fclose(fd);
++ close(fd);
+ return generated % max;
+ }
+ #endif