Skip to content

Commit 2275606

Browse files
authored
npdmtool: don't error with missing debug flags, error with multiple set (#50)
1 parent 0098896 commit 2275606

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ(2.61)
5-
AC_INIT([switch-tools],[1.13.0],[https://github.com/switchbrew/switch-tools/issues])
5+
AC_INIT([switch-tools],[1.13.1],[https://github.com/switchbrew/switch-tools/issues])
66
AC_CONFIG_SRCDIR([src/build_pfs0.c])
77

88
AM_INIT_AUTOMAKE([subdir-objects])

src/npdmtool.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -830,15 +830,11 @@ int CreateNpdm(const char *json, void **dst, u32 *dst_size) {
830830
int allow_debug = 0;
831831
int force_debug = 0;
832832
int force_debug_prod = 0;
833-
if (!cJSON_GetBoolean(value, "allow_debug", &allow_debug)) {
834-
status = 0;
835-
goto NPDM_BUILD_END;
836-
}
837-
if (!cJSON_GetBoolean(value, "force_debug", &force_debug)) {
838-
status = 0;
839-
goto NPDM_BUILD_END;
840-
}
841-
if (!cJSON_GetBoolean(value, "force_debug_prod", &force_debug_prod)) {
833+
cJSON_GetBoolean(value, "allow_debug", &allow_debug);
834+
cJSON_GetBoolean(value, "force_debug", &force_debug);
835+
cJSON_GetBoolean(value, "force_debug_prod", &force_debug_prod);
836+
if ( allow_debug + force_debug + force_debug_prod > 1 ) {
837+
fprintf(stderr, "Only one of allow_debug, force_debug, or force_debug_prod can be set!\n");
842838
status = 0;
843839
goto NPDM_BUILD_END;
844840
}

0 commit comments

Comments
 (0)