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

Commit 82477b5e authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Jaikumar Ganesh
Browse files

Change the fd to be blocking for health profile.

This is sync with the java IO stream APIs for the public APIs.

Change-Id: I5c7958687275d89257ac26f6a5abd08906327d02
parent 78137d77
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1645,6 +1645,25 @@ static jobject getChannelFdNative(JNIEnv *env, jobject object, jstring channelPa
        fd = dbus_returns_unixfd(env, reply);
        if (fd == -1) return NULL;

        int flags = fcntl(fd, F_GETFL);
        if (flags < 0) {
           LOGE("Can't get flags with fcntl(): %s (%d)",
                                strerror(errno), errno);
           releaseChannelFdNative(env, object, channelPath);
           close(fd);
           return NULL;
        }

        flags &= ~O_NONBLOCK;
        int status = fcntl(fd, F_SETFL, flags);
        if (status < 0) {
           LOGE("Can't set flags with fcntl(): %s (%d)",
               strerror(errno), errno);
           releaseChannelFdNative(env, object, channelPath);
           close(fd);
           return NULL;
        }

        // Create FileDescriptor object
        jobject fileDesc = jniCreateFileDescriptor(env, fd);
        if (fileDesc == NULL) {