-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathproxmox.patch
72 lines (69 loc) · 2.19 KB
/
proxmox.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
diff -Naur -x .git -x target -x tests -x Cargo.lock proxmox.m/.cargo/config proxmox/.cargo/config
--- proxmox.m/.cargo/config 2020-12-11 22:10:22.706632820 +0100
+++ proxmox/.cargo/config 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-[source]
-[source.debian-packages]
-directory = "/usr/share/cargo/registry"
-[source.crates-io]
-replace-with = "debian-packages"
diff -Naur -x .git -x target -x tests -x Cargo.lock proxmox.m/proxmox/Cargo.toml proxmox/proxmox/Cargo.toml
--- proxmox.m/proxmox/Cargo.toml 2020-12-11 22:10:23.038636468 +0100
+++ proxmox/proxmox/Cargo.toml 2020-12-06 21:49:46.850983390 +0100
@@ -18,6 +18,7 @@
[dependencies]
# General dependencies
anyhow = "1.0"
+getrandom = "0.1.14"
lazy_static = "1.4"
libc = "0.2"
nix = "0.19"
diff -Naur -x .git -x target -x tests -x Cargo.lock proxmox.m/proxmox/src/sys/linux/mod.rs proxmox/proxmox/src/sys/linux/mod.rs
--- proxmox.m/proxmox/src/sys/linux/mod.rs 2020-12-11 22:10:23.044636534 +0100
+++ proxmox/proxmox/src/sys/linux/mod.rs 2020-12-06 21:48:20.385990722 +0100
@@ -1,6 +1,7 @@
//! Linux specific helpers and syscall wrapper
use anyhow::*;
+use getrandom::getrandom;
pub mod magic;
pub mod pid;
@@ -20,22 +21,24 @@
///
/// This code uses the Linux syscall getrandom() - see "man 2 getrandom".
pub fn fill_with_random_data(buffer: &mut [u8]) -> Result<(), Error> {
- let res = unsafe {
- libc::getrandom(
- buffer.as_mut_ptr() as *mut libc::c_void,
- buffer.len() as libc::size_t,
- 0 as libc::c_uint,
- )
- };
-
- if res == -1 {
- return Err(std::io::Error::last_os_error().into());
- }
-
- if res as usize != buffer.len() {
- // should not happen
- bail!("short getrandom read");
- }
+// let res = unsafe {
+// libc::getrandom(
+// buffer.as_mut_ptr() as *mut libc::c_void,
+// buffer.len() as libc::size_t,
+// 0 as libc::c_uint,
+// )
+// };
+//
+// if res == -1 {
+// return Err(std::io::Error::last_os_error().into());
+// }
+//
+// if res as usize != buffer.len() {
+// // should not happen
+// bail!("short getrandom read");
+// }
+
+ getrandom(buffer)?;
Ok(())
}