Merge "Use Libcore.os.umask for setting umask"
This commit is contained in:
@ -53,8 +53,6 @@ public class FileUtils {
|
|||||||
|
|
||||||
public static native int setPermissions(String file, int mode, int uid, int gid);
|
public static native int setPermissions(String file, int mode, int uid, int gid);
|
||||||
|
|
||||||
public static native int setUMask(int mask);
|
|
||||||
|
|
||||||
/** returns the FAT file system volume ID for the volume mounted
|
/** returns the FAT file system volume ID for the volume mounted
|
||||||
* at the given mount point, or -1 for failure
|
* at the given mount point, or -1 for failure
|
||||||
* @param mountPoint point for FAT volume
|
* @param mountPoint point for FAT volume
|
||||||
|
@ -16,16 +16,17 @@
|
|||||||
|
|
||||||
package com.android.internal.os;
|
package com.android.internal.os;
|
||||||
|
|
||||||
|
import static libcore.io.OsConstants.S_IRWXG;
|
||||||
|
import static libcore.io.OsConstants.S_IRWXO;
|
||||||
|
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.LocalServerSocket;
|
import android.net.LocalServerSocket;
|
||||||
import android.os.Debug;
|
import android.os.Debug;
|
||||||
import android.os.FileUtils;
|
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.util.EventLog;
|
import android.util.EventLog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ import dalvik.system.VMRuntime;
|
|||||||
import dalvik.system.Zygote;
|
import dalvik.system.Zygote;
|
||||||
|
|
||||||
import libcore.io.IoUtils;
|
import libcore.io.IoUtils;
|
||||||
|
import libcore.io.Libcore;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
@ -447,7 +449,7 @@ public class ZygoteInit {
|
|||||||
closeServerSocket();
|
closeServerSocket();
|
||||||
|
|
||||||
// set umask to 0077 so new files and directories will default to owner-only permissions.
|
// set umask to 0077 so new files and directories will default to owner-only permissions.
|
||||||
FileUtils.setUMask(FileUtils.S_IRWXG | FileUtils.S_IRWXO);
|
Libcore.os.umask(S_IRWXG | S_IRWXO);
|
||||||
|
|
||||||
if (parsedArgs.niceName != null) {
|
if (parsedArgs.niceName != null) {
|
||||||
Process.setArgV0(parsedArgs.niceName);
|
Process.setArgV0(parsedArgs.niceName);
|
||||||
|
@ -55,11 +55,6 @@ jint android_os_FileUtils_setPermissions(JNIEnv* env, jobject clazz,
|
|||||||
return chmod(file8.string(), mode) == 0 ? 0 : errno;
|
return chmod(file8.string(), mode) == 0 ? 0 : errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
jint android_os_FileUtils_setUMask(JNIEnv* env, jobject clazz, jint mask)
|
|
||||||
{
|
|
||||||
return umask(mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring path)
|
jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring path)
|
||||||
{
|
{
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
@ -83,7 +78,6 @@ jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring pat
|
|||||||
|
|
||||||
static const JNINativeMethod methods[] = {
|
static const JNINativeMethod methods[] = {
|
||||||
{"setPermissions", "(Ljava/lang/String;III)I", (void*)android_os_FileUtils_setPermissions},
|
{"setPermissions", "(Ljava/lang/String;III)I", (void*)android_os_FileUtils_setPermissions},
|
||||||
{"setUMask", "(I)I", (void*)android_os_FileUtils_setUMask},
|
|
||||||
{"getFatVolumeId", "(Ljava/lang/String;)I", (void*)android_os_FileUtils_getFatVolumeId},
|
{"getFatVolumeId", "(Ljava/lang/String;)I", (void*)android_os_FileUtils_getFatVolumeId},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user