MISC: address warnings

This commit is contained in:
imkiva 2021-05-07 18:52:32 +08:00 committed by Kiva Oyama
parent 9d466997f7
commit 313fa29ab5

View File

@ -100,8 +100,7 @@ static int create_subprocess(JNIEnv *env,
char *error_message; char *error_message;
// No need to free asprintf()-allocated memory since doing execvp() or exit() below. // No need to free asprintf()-allocated memory since doing execvp() or exit() below.
if (asprintf(&error_message, "chdir(\"%s\")", cwd) == -1) if (asprintf(&error_message, "chdir(\"%s\")", cwd) == -1)
error_message = error_message = const_cast<char *>("chdir()");
const_cast<char *>("chdir()");
perror(error_message); perror(error_message);
fflush(stderr); fflush(stderr);
} }
@ -109,7 +108,7 @@ static int create_subprocess(JNIEnv *env,
// Show terminal output about failing exec() call: // Show terminal output about failing exec() call:
char *error_message; char *error_message;
if (asprintf(&error_message, "exec(\"%s\")", cmd) == -1) if (asprintf(&error_message, "exec(\"%s\")", cmd) == -1)
const_cast<char *>("exec()");; error_message = const_cast<char *>("exec()");;
perror(error_message); perror(error_message);
_exit(1); _exit(1);
} }