We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1da316 commit 00eebb1Copy full SHA for 00eebb1
src/main/c/src/SerialImp.c
@@ -738,7 +738,10 @@ JNIEXPORT jint JNICALL RXTXPort(open)(
738
}
739
#endif /* OPEN_EXCL */
740
741
- if( configure_port( fd ) ) goto fail;
+ if( configure_port( fd ) ) {
742
+ close(fd);
743
+ goto fail;
744
+ }
745
(*env)->ReleaseStringUTFChars( env, jstr, filename );
746
snprintf( message, sizeof(message), "open: fd returned is %i\n", fd );
747
report( message );
@@ -747,6 +750,7 @@ JNIEXPORT jint JNICALL RXTXPort(open)(
750
return (jint)fd;
748
751
749
752
fail:
753
+ UNLOCK(filename, pid);
754
755
LEAVE( "RXTXPort:open" );
756
throw_java_exception( env, PORT_IN_USE_EXCEPTION, "open",
0 commit comments