fix write panic

This commit is contained in:
Daniella / Tove 2022-08-14 23:39:37 +02:00
parent 8aa7fe2129
commit b4295c14ca

View file

@ -272,7 +272,7 @@ fn receiver(args: &Vec<String>) {
let mut buf: Vec<u8> = Vec::new();
buf.resize(br as usize, 0);
let mut buf: &[u8] = buf.leak();
let mut file = OpenOptions::new().truncate(false).open(args.get(4).unwrap_or_else(|| {
let mut file = OpenOptions::new().truncate(false).write(true).create(true).open(&args.get(4).unwrap_or_else(|| {
print_args(args);
panic!("unreachable")
}))