Skip to content

Commit

Permalink
Change to use ENDIF rather than ELSE for CRIU_SUPPORT
Browse files Browse the repository at this point in the history
The CRIU is enabled by default for the
Linux platforms. That means all the
Linux builds are CRIU. But it need a
command line option to enable it at
runtime if someone wants to use CRIU.

There was an error in our current code.
During the build, the preprocessor
eliminate the code in the [ELSE]
CRIU_SUPPORT. This would cause error if
the --enable-criu-support jvm option
is not enabled in an application. The
application need the logic within [ELSE]
CRIU_SUPPORT. Therefore, we use the
[ENDIF] to replace the [ELSE] in the code.
  • Loading branch information
WilburZjh committed Jan 4, 2024
1 parent a0b7158 commit b52951e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,9 @@ private static void readFully(InputStream in, byte[] data, Variant variant)
if (in.readNBytes(data, 0, len) < len) {
throw new IOException("Could not read from file(s)");
}
return;
}
/*[ELSE] CRIU_SUPPORT */
/*[ENDIF] CRIU_SUPPORT */
int ofs = 0;
while (len > 0) {
int k = in.read(data, ofs, len);
Expand All @@ -522,7 +523,6 @@ private static void readFully(InputStream in, byte[] data, Variant variant)
if (len > 0) {
throw new IOException("Could not read from file(s)");
}
/*[ENDIF] CRIU_SUPPORT */
}

// get true random bytes, just read from "seed"
Expand Down Expand Up @@ -634,8 +634,9 @@ private void implNextBytes(byte[] data) {
for (int i = 0; i < data.length; i++) {
data[i] ^= rawData[i];
}
return;
}
/*[ELSE] CRIU_SUPPORT */
/*[ENDIF] CRIU_SUPPORT */
int data_len = data.length;
int ofs = 0;
int len;
Expand Down Expand Up @@ -665,7 +666,6 @@ private void implNextBytes(byte[] data) {
}
data_len -= len;
}
/*[ENDIF] CRIU_SUPPORT */
} catch (IOException e){
throw new ProviderException("nextBytes() failed", e);
}
Expand Down

0 comments on commit b52951e

Please sign in to comment.