/* Like `dup' in C. */
public static native int dup (int fd);
+ /* Like `close' in C. */
+ public static native int close (int fd);
+
/* Obtain the fingerprint of this build of Emacs. The fingerprint
can be used to determine the dump file name. */
public static native String getFingerprint ();
if (data == null || data.getItemCount () < 1)
return null;
+ fd = -1;
+
try
{
uri = data.getItemAt (0).getUri ();
/* Close the original offset. */
assetFd.close ();
}
+ catch (SecurityException e)
+ {
+ /* Guarantee a file descriptor duplicated or detached is
+ ultimately closed if an error arises. */
+
+ if (fd != -1)
+ EmacsNative.close (fd);
+
+ return null;
+ }
catch (FileNotFoundException e)
{
+ /* Guarantee a file descriptor duplicated or detached is
+ ultimately closed if an error arises. */
+
+ if (fd != -1)
+ EmacsNative.close (fd);
+
return null;
}
catch (IOException e)
{
+ /* Guarantee a file descriptor duplicated or detached is
+ ultimately closed if an error arises. */
+
+ if (fd != -1)
+ EmacsNative.close (fd);
+
return null;
}
return dup (fd);
}
+JNIEXPORT jint JNICALL
+NATIVE_NAME (close) (JNIEnv *env, jobject object, jint fd)
+{
+ JNI_STACK_ALIGNMENT_PROLOGUE;
+
+ return close (fd);
+}
+
JNIEXPORT jstring JNICALL
NATIVE_NAME (getFingerprint) (JNIEnv *env, jobject object)
{