From a095768910dde7a8581aa018eceef5f2f899d1fa Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 24 May 2024 14:54:23 -0400 Subject: unprotbas: fix exit status. --- unprotbas.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'unprotbas.c') diff --git a/unprotbas.c b/unprotbas.c index 686b8c3..cfdcf75 100644 --- a/unprotbas.c +++ b/unprotbas.c @@ -231,8 +231,10 @@ void breakcode(void) { break; } else { offset = data[pos + 2]; - if(!offset) - die("program already was code-protected"); + if(!offset) { + fprintf(stderr, "%s: program already was code-protected.\n", self); + exit(2); + } oldpos = pos; pos += offset; } @@ -732,6 +734,7 @@ int main(int argc, char **argv) { } if(protect_vars) scramble_vars(); if(protect_code) breakcode(); + was_protected = 1; /* opposite sense for this one */ } else { if(readmap) { was_protected = !vntable_ok(); @@ -764,10 +767,7 @@ int main(int argc, char **argv) { if(checkonly) { if(verbose) fprintf(stderr, "Check-only mode; no output written.\n"); - if(was_protected) - return 0; - else - return 2; + return was_protected ? 0 : 2; } } @@ -777,5 +777,5 @@ int main(int argc, char **argv) { if(writemap) write_var_map(); - return 0; + return was_protected ? 0 : 2; } -- cgit v1.2.3