ref: 95b9b8863d747698cfb27d92f6160a588703acf3
parent: 76ed42e31ff3297f1ca9b144ccc9466b0074f92b
author: Alex Musolino <[email protected]>
date: Tue Jan 5 17:36:03 EST 2021
qr: fix exit status Call exits(0) instead of returning from main. Also call sysfatal if writing of image data fails. Previously, qr(1) would exit with default non-nil status "main" unconditionally as a result of returning from main.
--- a/sys/src/cmd/qr.c
+++ b/sys/src/cmd/qr.c
@@ -732,8 +732,11 @@
b = qrcode(ver, lev, mode, buf, rc, &s);
if(b == nil)
sysfatal("%r");
- print("%11s %11d %11d %11d %11d ", "k8", 0, 0, s, s);
- write(1, b, s * s);
+ if(print("%11s %11d %11d %11d %11d ", "k8", 0, 0, s, s) != 5*12)
+ sysfatal("print: %r");
+ if(write(1, b, s*s) != s*s)
+ sysfatal("write: %r");
+ exits(0);
}
uchar qrrawpolys[] = {