aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2014-04-05 21:58:48 +0300
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2014-04-05 21:58:48 +0300
commitc4ae050b3222183fb76c331b5b55d75aa618b4fc (patch)
tree010a64c5645ba94ce66ffe3dc99ccceb5cbb7242
parent640b9d50c34dee92ebeaa9fb00bd8a85eb2adbef (diff)
downloadjitsi-c4ae050b3222183fb76c331b5b55d75aa618b4fc.zip
jitsi-c4ae050b3222183fb76c331b5b55d75aa618b4fc.tar.gz
jitsi-c4ae050b3222183fb76c331b5b55d75aa618b4fc.tar.bz2
Fixes javadocs, formatting.
-rw-r--r--src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java47
1 files changed, 26 insertions, 21 deletions
diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java
index fac1434..f5027b7 100644
--- a/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java
+++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java
@@ -19,6 +19,7 @@ import org.osgi.framework.*;
import java.io.*;
/**
+ *
* @author Emil Ivov
* @author Lyubomir Marinov
*/
@@ -110,13 +111,13 @@ public class ConfigurationActivator
}
/**
- * Makes home folder and the configuration file readable and writable
- * only to the owner.
- * @param configurationService the config service instance to check
- * for home folder and name.
+ * Makes home folder and the configuration file readable and writable only
+ * to the owner.
+ *
+ * @param cs the <tt>ConfigurationService</tt> instance to check for home
+ * folder and configuration file.
*/
- private static void fixPermissions(
- ConfigurationService configurationService)
+ private static void fixPermissions(ConfigurationService cs)
{
if(!OSUtils.IS_LINUX && !OSUtils.IS_MAC)
return;
@@ -124,46 +125,50 @@ public class ConfigurationActivator
try
{
// let's check config file and config folder
- File homeFolder = new File(
- configurationService.getScHomeDirLocation(),
- configurationService.getScHomeDirName());
-
+ File homeFolder
+ = new File(cs.getScHomeDirLocation(), cs.getScHomeDirName());
CLibrary libc = (CLibrary) Native.loadLibrary("c", CLibrary.class);
+
libc.chmod(homeFolder.getAbsolutePath(), 0700);
- String fileName = configurationService.getConfigurationFilename();
+ String fileName = cs.getConfigurationFilename();
if(fileName != null)
{
File cf = new File(homeFolder, fileName);
if(cf.exists())
- {
libc.chmod(cf.getAbsolutePath(), 0600);
- }
}
}
catch(Throwable t)
{
logger.error(
- "Error creating c lib instance for fixing file permissions", t);
+ "Error creating c lib instance for fixing file permissions",
+ t);
+
+ if (t instanceof InterruptedException)
+ Thread.currentThread().interrupt();
+ else if (t instanceof ThreadDeath)
+ throw (ThreadDeath) t;
}
}
/**
- * The jna interface to the c library and the chmod we use
- * to fix permissions of user files.
+ * The JNA interface to the <tt>c</tt> library and the <tt>chmod</tt>
+ * function we use to fix permissions of user files and folders.
*/
public interface CLibrary
extends Library
{
/**
* Changes file permissions.
- * @param path the path to file or folder which permissions we will
- * change.
+ *
+ * @param path the path to the file or folder the permissions of which
+ * are to be changed.
* @param mode the mode operand
- * @return 0 shall be returned upon successful completion;
- * otherwise, -1 shall be returned. If -1 is returned,
- * no change to the file mode occurs.
+ * @return <tt>0</tt> upon successful completion; otherwise,
+ * <tt>-1</tt>. If <tt>-1</tt> is returned, no change to the file mode
+ * occurs.
*/
public int chmod(String path, int mode);
}