Merge
This commit is contained in:
commit
a2a4b3cc29
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -83,9 +83,6 @@ void SharedPathsMiscInfo::print_path(int type, const char* path) {
|
|||||||
case NON_EXIST:
|
case NON_EXIST:
|
||||||
out->print("Expecting that %s does not exist", path);
|
out->print("Expecting that %s does not exist", path);
|
||||||
break;
|
break;
|
||||||
case REQUIRED:
|
|
||||||
out->print("Expecting that file %s must exist and is not altered", path);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
ShouldNotReachHere();
|
ShouldNotReachHere();
|
||||||
}
|
}
|
||||||
@ -130,37 +127,13 @@ bool SharedPathsMiscInfo::check(jint type, const char* path) {
|
|||||||
return fail("[BOOT classpath mismatch, actual =", Arguments::get_sysclasspath());
|
return fail("[BOOT classpath mismatch, actual =", Arguments::get_sysclasspath());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NON_EXIST: // fall-through
|
case NON_EXIST:
|
||||||
case REQUIRED:
|
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (os::stat(path, &st) != 0) {
|
if (os::stat(path, &st) == 0) {
|
||||||
// The file does not actually exist
|
|
||||||
if (type == REQUIRED) {
|
|
||||||
// but we require it to exist -> fail
|
|
||||||
return fail("Required file doesn't exist");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// The file actually exists
|
// The file actually exists
|
||||||
if (type == NON_EXIST) {
|
// But we want it to not exist -> fail
|
||||||
// But we want it to not exist -> fail
|
return fail("File must not exist");
|
||||||
return fail("File must not exist");
|
|
||||||
}
|
|
||||||
if ((st.st_mode & S_IFMT) != S_IFREG) {
|
|
||||||
return fail("Did not get a regular file as expected.");
|
|
||||||
}
|
|
||||||
time_t timestamp;
|
|
||||||
long filesize;
|
|
||||||
|
|
||||||
if (!read_time(×tamp) || !read_long(&filesize)) {
|
|
||||||
return fail("Corrupted archive file header");
|
|
||||||
}
|
|
||||||
if (timestamp != st.st_mtime) {
|
|
||||||
return fail("Timestamp mismatch");
|
|
||||||
}
|
|
||||||
if (filesize != st.st_size) {
|
|
||||||
return fail("File size mismatch");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -128,15 +128,13 @@ public:
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
BOOT = 1,
|
BOOT = 1,
|
||||||
NON_EXIST = 2,
|
NON_EXIST = 2
|
||||||
REQUIRED = 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual const char* type_name(int type) {
|
virtual const char* type_name(int type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BOOT: return "BOOT";
|
case BOOT: return "BOOT";
|
||||||
case NON_EXIST: return "NON_EXIST";
|
case NON_EXIST: return "NON_EXIST";
|
||||||
case REQUIRED: return "REQUIRED";
|
|
||||||
default: ShouldNotReachHere(); return "?";
|
default: ShouldNotReachHere(); return "?";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user