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.
This commit is contained in:
parent
76ed42e31f
commit
95b9b8863d
1 changed files with 5 additions and 2 deletions
|
@ -732,8 +732,11 @@ main(int argc, char **argv)
|
|||
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[] = {
|
||||
|
|
Loading…
Reference in a new issue