eclipse/eclipse-do-not-run-as-root....

37 lines
1.7 KiB
Diff

--- rt.equinox.framework/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java 2012-05-05 14:41:12.000000000 +0200
+++ rt.equinox.framework/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java 2012-05-18 15:28:28.553493782 +0200
@@ -235,6 +235,9 @@
protected BufferedWriter log = null;
protected boolean newSession = true;
+ private boolean forbiddenMasterEclipse;
+ private static final String FORBIDDEN_MASTER_ECLIPSE = "-preventMasterEclipseLaunch";
+
// for variable substitution
public static final String VARIABLE_DELIM_STRING = "$"; //$NON-NLS-1$
public static final char VARIABLE_DELIM_CHAR = '$';
@@ -555,6 +558,12 @@
setupVMProperties();
processConfiguration();
+if (forbiddenMasterEclipse && System.getProperty(PROP_SHARED_CONFIG_AREA) == null) { //$NON-NLS-1$
+ System.err.println("This application should not be run by the owner of the shared configuration.");
+ System.setProperty(PROP_EXITCODE, "" + 14); //$NON-NLS-1$
+ return;
+ }
+
// need to ensure that getInstallLocation is called at least once to initialize the value.
// Do this AFTER processing the configuration to allow the configuration to set
// the install location.
@@ -1532,6 +1541,10 @@
// passed thru this arg (i.e., do not set found = true)
continue;
}
+ if (args[i].equalsIgnoreCase(FORBIDDEN_MASTER_ECLIPSE)) {
+ forbiddenMasterEclipse = true;
+ found = true;
+ }
// check if development mode should be enabled for the entire platform
// If this is the last arg or there is a following arg (i.e., arg+1 has a leading -),