aboutsummaryrefslogtreecommitdiff
path: root/unprotbas.c
diff options
context:
space:
mode:
Diffstat (limited to 'unprotbas.c')
-rw-r--r--unprotbas.c14
1 files changed, 7 insertions, 7 deletions
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;
}