Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f029c22f authored by Kenny Root's avatar Kenny Root Committed by android code review
Browse files

Merge "Use Libcore.os.umask for setting umask"

parents e0024573 4c74f8c1
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ public class FileUtils {

    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 
     * at the given mount point, or -1 for failure
     * @param mountPoint point for FAT volume
+5 −3
Original line number Diff line number Diff line
@@ -16,16 +16,17 @@

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.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.net.LocalServerSocket;
import android.os.Debug;
import android.os.FileUtils;
import android.os.Process;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.util.EventLog;
import android.util.Log;

@@ -33,6 +34,7 @@ import dalvik.system.VMRuntime;
import dalvik.system.Zygote;

import libcore.io.IoUtils;
import libcore.io.Libcore;

import java.io.BufferedReader;
import java.io.FileDescriptor;
@@ -447,7 +449,7 @@ public class ZygoteInit {
        closeServerSocket();

        // 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) {
            Process.setArgV0(parsedArgs.niceName);
+0 −6
Original line number Diff line number Diff line
@@ -55,11 +55,6 @@ jint android_os_FileUtils_setPermissions(JNIEnv* env, jobject clazz,
    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)
{
    if (path == NULL) {
@@ -83,7 +78,6 @@ jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring pat

static const JNINativeMethod methods[] = {
    {"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},
};